Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 149649 | Differences between
and this patch

Collapse All | Expand All

(-)gcc-4.1.1.GENTOO_2006-10-08/gcc/config/gentoo-hardened/arch/hardened-x86_64.h (+46 lines)
Line 0 Link Here
1
/* Copyright 1999-2006 Gentoo Foundation */
2
/* Distributed under the terms of the GNU General Public License v2 */
3
/* $Header: $ */
4
5
#ifndef LINUX_HARDENED_X86_64_H
6
#define LINUX_HARDENED_X86_64_H
7
8
#include "../libc-defs.h"
9
#include "../policy-defs.h"
10
#include "../specs-filters.h"
11
12
#if defined (GENTOO_HARDENED_GCC_LIBC_CRT1_NAME_NORMAL) && \
13
	defined (GENTOO_HARDENED_GCC_LIBC_CRT1_NAME_PIE)
14
15
#ifndef GENTOO_HARDENED_GCC_ARCH_STARTFILE_SPEC
16
#define GENTOO_HARDENED_GCC_ARCH_STARTFILE_SPEC  " YYY " GENTOO_HARDENED_GCC_LIBC_CRT1_NAME_NORMAL " YYY " GENTOO_HARDENED_GCC_LIBC_CRT1_NAME_PIE
17
#endif
18
19
#ifndef GENTOO_HARDENED_GCC_ARCH_ENDFILE_SPEC
20
#define GENTOO_HARDENED_GCC_ARCH_ENDFILE_SPEC " ZZZ "
21
#endif
22
23
#endif
24
25
/*
26
 * set up the following definitions for replacing sections
27
 */
28
29
#ifndef GENTOO_HARDENED_GCC_ARCH_ASM_SPEC
30
#define GENTOO_HARDENED_GCC_ARCH_ASM_SPEC "%{filter: %{filterbla: -K PIC } }"
31
#endif
32
33
#ifndef GENTOO_HARDENED_GCC_ARCH_CPP_SPEC
34
#define GENTOO_HARDENED_GCC_ARCH_CPP_SPEC "-bla -bla"
35
#endif
36
37
#ifndef GENTOO_HARDENED_GCC_ARCH_CC1_SPEC
38
#define GENTOO_HARDENED_GCC_ARCH_CC1_SPEC "-dumdidum"
39
#endif
40
41
#ifndef GENTOO_HARDENED_GCC_ARCH_LINK_PIE_SPEC
42
#define GENTOO_HARDENED_GCC_ARCH_LINK_PIE_SPEC "%{!pie: %{!nopie: -pie} }"
43
#endif
44
45
#endif
46
(-)gcc-4.1.1.GENTOO_2006-10-08/gcc/config/gentoo-hardened/hardened-callouts.h (+37 lines)
Line 0 Link Here
1
/* Copyright 1999-2006 Gentoo Foundation */
2
/* Distributed under the terms of the GNU General Public License v2 */
3
/* $Header: $ */
4
5
#ifndef LINUX_HARDENED_CALLOUTS_H
6
#define LINUX_HARDENED_CALLOUTS_H
7
8
#if defined(GENTOO_HARDENED_GCC_MODE) && \
9
	defined(GENTOO_HARDENED_GCC_MODE_CALLOUT) && \
10
	GENTOO_HARDENED_GCC_MODE & GENTOO_HARDENED_GCC_MODE_CALLOUT
11
12
#define GENTOO_HARDENED_GCC_ASM_SPEC_PIE_CALLOUT " %(hardened_asm_pie) "
13
14
#define GENTOO_HARDENED_GCC_CPP_SPEC_PIE_CALLOUT " %(hardened_cpp_pie) "
15
16
#define GENTOO_HARDENED_GCC_CC1_SPEC_PIE_CALLOUT " %(hardened_cc1_pie) "
17
#define GENTOO_HARDENED_GCC_CC1_SPEC_SSP_CALLOUT " %(hardened_cc1_ssp) "
18
#define GENTOO_HARDENED_GCC_CC1_SPEC_SSP_ALL_CALLOUT " %(hardened_cc1_ssp_all) "
19
20
#define GENTOO_HARDENED_GCC_LINK_PIE_SPEC_PIE_CALLOUT " %(hardened_link_pie) "
21
22
#else
23
24
#define GENTOO_HARDENED_GCC_ASM_SPEC_PIE_CALLOUT ""
25
26
#define GENTOO_HARDENED_GCC_CPP_SPEC_PIE_CALLOUT ""
27
28
#define GENTOO_HARDENED_GCC_CC1_SPEC_PIE_CALLOUT ""
29
#define GENTOO_HARDENED_GCC_CC1_SPEC_SSP_CALLOUT ""
30
#define GENTOO_HARDENED_GCC_CC1_SPEC_SSP_ALL_CALLOUT ""
31
32
#define GENTOO_HARDENED_GCC_LINK_PIE_SPEC_PIE_CALLOUT ""
33
34
#endif
35
36
#endif
37
(-)gcc-4.1.1.GENTOO_2006-10-08/gcc/config/gentoo-hardened/hardened.h (+96 lines)
Line 0 Link Here
1
/* Copyright 1999-2006 Gentoo Foundation */
2
/* Distributed under the terms of the GNU General Public License v2 */
3
/* $Header: $ */
4
5
#ifndef LINUX_HARDENED_H
6
#define LINUX_HARDENED_H
7
8
#include "mode-defs.h"
9
#include "hardened-callouts.h"
10
11
12
#if defined (HAVE_LD_PIE) && \
13
	defined (GENTOO_HARDENED_GCC_MODE) && \
14
	defined (GENTOO_HARDENED_GCC_MODE_BUILTIN) && \
15
			 GENTOO_HARDENED_GCC_MODE & \
16
			 GENTOO_HARDENED_GCC_MODE_BUILTIN
17
18
19
#ifndef GENTOO_HARDENED_GCC_STARTFILE_SPEC
20
#ifdef GENTOO_HARDENED_GCC_ARCH_STARTFILE_SPEC
21
#define GENTOO_HARDENED_GCC_STARTFILE_SPEC GENTOO_HARDENED_GCC_ARCH_STARTFILE_SPEC
22
#endif
23
#endif
24
25
#ifndef GENTOO_HARDENED_GCC_ENDFILE_SPEC
26
#ifdef GENTOO_HARDENED_GCC_ARCH_ENDFILE_SPEC
27
#define GENTOO_HARDENED_GCC_ENDFILE_SPEC GENTOO_HARDENED_GCC_ARCH_ENDFILE_SPEC
28
#endif
29
#endif
30
31
#ifndef GENTOO_HARDENED_GCC_ASM_SPEC
32
#ifndef GENTOO_HARDENED_GCC_ARCH_ASM_SPEC
33
#define GENTOO_HARDENED_GCC_ASM_SPEC \
34
		GENTOO_HARDENED_GCC_ASM_SPEC_PIE_CALLOUT
35
#else
36
#define GENTOO_HARDENED_GCC_ASM_SPEC \
37
		GENTOO_HARDENED_GCC_ARCH_ASM_SPEC \
38
		GENTOO_HARDENED_GCC_ASM_SPEC_PIE_CALLOUT
39
#endif
40
#endif
41
42
#ifndef GENTOO_HARDENED_GCC_CPP_SPEC
43
#ifndef GENTOO_HARDENED_GCC_ARCH_CPP_SPEC
44
#define GENTOO_HARDENED_GCC_CPP_SPEC \
45
		GENTOO_HARDENED_GCC_CPP_SPEC_PIE_CALLOUT
46
#else
47
#define GENTOO_HARDENED_GCC_CPP_SPEC \
48
		GENTOO_HARDENED_GCC_ARCH_CPP_SPEC \
49
		GENTOO_HARDENED_GCC_CPP_SPEC_PIE_CALLOUT
50
#endif
51
#endif
52
53
#ifndef GENTOO_HARDENED_GCC_CC1_SPEC
54
#ifndef GENTOO_HARDENED_GCC_ARCH_CC1_SPEC
55
#define GENTOO_HARDENED_GCC_CC1_SPEC \
56
		GENTOO_HARDENED_GCC_CC1_SPEC_PIE_CALLOUT \
57
		GENTOO_HARDENED_GCC_CC1_SPEC_SSP_CALLOUT \
58
		GENTOO_HARDENED_GCC_CC1_SPEC_SSP_ALL_CALLOUT
59
#else
60
#define GENTOO_HARDENED_GCC_CC1_SPEC \
61
		GENTOO_HARDENED_GCC_ARCH_CC1_SPEC \
62
		GENTOO_HARDENED_GCC_CC1_SPEC_PIE_CALLOUT \
63
		GENTOO_HARDENED_GCC_CC1_SPEC_SSP_CALLOUT \
64
		GENTOO_HARDENED_GCC_CC1_SPEC_SSP_ALL_CALLOUT
65
#endif
66
#endif
67
68
#ifndef GENTOO_HARDENED_GCC_LINK_PIE_SPEC
69
#ifndef GENTOO_HARDENED_GCC_ARCH_LINK_PIE_SPEC
70
#define GENTOO_HARDENED_GCC_LINK_PIE_SPEC \
71
		GENTOO_HARDENED_GCC_LINK_PIE_SPEC_PIE_CALLOUT
72
#else
73
#define GENTOO_HARDENED_GCC_LINK_PIE_SPEC \
74
		GENTOO_HARDENED_GCC_ARCH_LINK_PIE_SPEC \
75
		GENTOO_HARDENED_GCC_LINK_PIE_SPEC_PIE_CALLOUT
76
#endif
77
#endif
78
79
80
#else
81
82
83
#undef GENTOO_HARDENED_GCC_STARTFILE_SPEC
84
#undef GENTOO_HARDENED_GCC_ENDFILE_SPEC
85
86
#define GENTOO_HARDENED_GCC_ASM_SPEC ""
87
#define GENTOO_HARDENED_GCC_CPP_SPEC ""
88
#define GENTOO_HARDENED_GCC_CC1_SPEC ""
89
#define GENTOO_HARDENED_GCC_LINK_PIE_SPEC ""
90
91
92
#endif
93
94
95
#endif
96
(-)gcc-4.1.1.GENTOO_2006-10-08/gcc/config/gentoo-hardened/libc-defs.h (+35 lines)
Line 0 Link Here
1
/* Copyright 1999-2006 Gentoo Foundation */
2
/* Distributed under the terms of the GNU General Public License v2 */
3
/* $Header: $ */
4
5
/*
6
 * support for uclibc (when triggered in config.gcc by target) and glibc (default behaviour)
7
 */
8
9
#ifndef LINUX_LIBC_DEFS_H
10
#define LINUX_LIBC_DEFS_H
11
12
#ifdef USE_UCLIBC
13
14
#ifndef GENTOO_HARDENED_GCC_LIBC_CRT1_NAME_NORMAL
15
#define GENTOO_HARDENED_GCC_LIBC_CRT1_NAME_NORMAL "UCLIBC crt1.o UCLIBC"
16
#endif
17
18
#ifndef GENTOO_HARDENED_GCC_LIBC_CRT1_NAME_PIE
19
#define GENTOO_HARDENED_GCC_LIBC_CRT1_NAME_PIE "UCLIBC Scrt1.o UCLIBC"
20
#endif
21
22
#else
23
24
#ifndef GENTOO_HARDENED_GCC_LIBC_CRT1_NAME_NORMAL
25
#define GENTOO_HARDENED_GCC_LIBC_CRT1_NAME_NORMAL "crt1.o"
26
#endif
27
28
#ifndef GENTOO_HARDENED_GCC_LIBC_CRT1_NAME_PIE
29
#define GENTOO_HARDENED_GCC_LIBC_CRT1_NAME_PIE "Scrt1.o"
30
#endif
31
32
#endif
33
34
#endif
35
(-)gcc-4.1.1.GENTOO_2006-10-08/gcc/config/gentoo-hardened/mode-defs.h (+22 lines)
Line 0 Link Here
1
/* Copyright 1999-2006 Gentoo Foundation */
2
/* Distributed under the terms of the GNU General Public License v2 */
3
/* $Header: $ */
4
5
#ifndef LINUX_MODE_DEFS_H
6
#define LINUX_MODE_DEFS_H
7
8
#define GENTOO_HARDENED_GCC_MODE_VANILLA 0
9
#define GENTOO_HARDENED_GCC_MODE_CALLOUT 1
10
#define GENTOO_HARDENED_GCC_MODE_BUILTIN 2
11
12
//#undef  GENTOO_HARDENED_GCC_MODE
13
//#define GENTOO_HARDENED_GCC_MODE GENTOO_HARDENED_GCC_MODE_VANILLA
14
15
// #undef  GENTOO_HARDENED_GCC_MODE
16
// #define GENTOO_HARDENED_GCC_MODE GENTOO_HARDENED_GCC_MODE_CALLOUT
17
18
//#undef  GENTOO_HARDENED_GCC_MODE
19
#define GENTOO_HARDENED_GCC_MODE 3 // GENTOO_HARDENED_GCC_MODE_BUILTIN
20
21
#endif
22
(-)gcc-4.1.1.GENTOO_2006-10-08/gcc/config/gentoo-hardened/policy-defs.h (+32 lines)
Line 0 Link Here
1
/* Copyright 1999-2006 Gentoo Foundation */
2
/* Distributed under the terms of the GNU General Public License v2 */
3
/* $Header: $ */
4
5
#ifndef LINUX_POLICY_DEFS_H
6
#define LINUX_POLICY_DEFS_H
7
8
#define GENTOO_HARDENED_GCC_POLICY_AUTO_NONE 0
9
#define GENTOO_HARDENED_GCC_POLICY_AUTO_PIE 1
10
#define GENTOO_HARDENED_GCC_POLICY_AUTO_SSP 2
11
#define GENTOO_HARDENED_GCC_POLICY_AUTO_PIE_SSP 4
12
13
#undef  GENTOO_HARDENED_GCC_POLICY
14
#define GENTOO_HARDENED_GCC_POLICY GENTOO_HARDENED_GCC_POLICY_AUTO_NONE
15
16
/* uncomment for automatic PIE building
17
#undef  GENTOO_HARDENED_GCC_POLICY
18
#define GENTOO_HARDENED_GCC_POLICY GENTOO_HARDENED_GCC_POLICY_AUTO_PIE
19
*/
20
21
/* uncomment for automatic SSP building
22
#undef  GENTOO_HARDENED_GCC_POLICY
23
#define GENTOO_HARDENED_GCC_POLICY GENTOO_HARDENED_GCC_POLICY_AUTO_SSP
24
*/
25
26
/* uncomment for automatic PIE SSP building
27
#undef  GENTOO_HARDENED_GCC_POLICY
28
#define GENTOO_HARDENED_GCC_POLICY GENTOO_HARDENED_GCC_POLICY_AUTO_PIE_SSP
29
*/
30
31
#endif
32
(-)gcc-4.1.1.GENTOO_2006-10-08/gcc/config/gentoo-hardened/specs-filters.h (+9 lines)
Line 0 Link Here
1
/* Copyright 1999-2006 Gentoo Foundation */
2
/* Distributed under the terms of the GNU General Public License v2 */
3
/* $Header: $ */
4
5
#ifndef LINUX_SPECS_FILTERS_H
6
#define LINUX_SPECS_FILTERS_H
7
8
#endif
9
(-)gcc-4.1.1.GENTOO_2006-10-08/gcc/config.gcc (-1 / +7 lines)
Lines 325-331 Link Here
325
        ;;
325
        ;;
326
esac
326
esac
327
327
328
tm_file=${cpu_type}/${cpu_type}.h
328
hardened_dir="gentoo-hardened"
329
hardened_arc="${hardened_dir}/arch/hardened-${cpu_type}.h"
330
hardened_all="${hardened_dir}/hardened.h"
331
hardened_gcc="${hardened_arc} ${hardened_all}"
332
333
tm_file="${hardened_gcc} ${cpu_type}/${cpu_type}.h"
334
329
if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-protos.h
335
if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-protos.h
330
then
336
then
331
	tm_p_file=${cpu_type}/${cpu_type}-protos.h
337
	tm_p_file=${cpu_type}/${cpu_type}-protos.h
(-)gcc-4.1.1.GENTOO_2006-10-08/gcc/gcc.c (-4 / +18 lines)
Lines 87-92 Link Here
87
#include "gcc.h"
87
#include "gcc.h"
88
#include "flags.h"
88
#include "flags.h"
89
89
90
#include "hardened-stubs.h"
91
90
/* By default there is no special suffix for target executables.  */
92
/* By default there is no special suffix for target executables.  */
91
/* FIXME: when autoconf is fixed, remove the host check - dj */
93
/* FIXME: when autoconf is fixed, remove the host check - dj */
92
#if defined(TARGET_EXECUTABLE_SUFFIX) && defined(HOST_EXECUTABLE_SUFFIX)
94
#if defined(TARGET_EXECUTABLE_SUFFIX) && defined(HOST_EXECUTABLE_SUFFIX)
Lines 628-633 Link Here
628
  "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}"
630
  "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}"
629
#endif
631
#endif
630
632
633
/* Gentoo Hardened definitions may overwrite the default specs */
634
#ifdef GENTOO_HARDENED_GCC_STARTFILE_SPEC
635
#undef STARTFILE_SPEC
636
#define STARTFILE_SPEC GENTOO_HARDENED_GCC_STARTFILE_SPEC
637
#endif
638
631
/* config.h can define SWITCHES_NEED_SPACES to control which options
639
/* config.h can define SWITCHES_NEED_SPACES to control which options
632
   require spaces between the option and the argument.  */
640
   require spaces between the option and the argument.  */
633
#ifndef SWITCHES_NEED_SPACES
641
#ifndef SWITCHES_NEED_SPACES
Lines 639-644 Link Here
639
#define ENDFILE_SPEC ""
647
#define ENDFILE_SPEC ""
640
#endif
648
#endif
641
649
650
/* Gentoo Hardened definitions may overwrite the default specs */
651
#ifdef GENTOO_HARDENED_GCC_ENDFILE_SPEC
652
#undef ENDFILE_SPEC
653
#define ENDFILE_SPEC GENTOO_HARDENED_GCC_ENDFILE_SPEC
654
#endif
655
642
#ifndef LINKER_NAME
656
#ifndef LINKER_NAME
643
#define LINKER_NAME "collect2"
657
#define LINKER_NAME "collect2"
644
#endif
658
#endif
Lines 699-705 Link Here
699
#ifndef LINK_COMMAND_SPEC
713
#ifndef LINK_COMMAND_SPEC
700
#define LINK_COMMAND_SPEC "\
714
#define LINK_COMMAND_SPEC "\
701
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
715
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
702
    %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
716
    %(linker) %l " LINK_PIE_SPEC GENTOO_HARDENED_GCC_LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
703
    %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
717
    %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
704
    %{static:} %{L*} %(mfwrap) %(link_libgcc) %o %(mflib)\
718
    %{static:} %{L*} %(mfwrap) %(link_libgcc) %o %(mflib)\
705
    %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
719
    %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
Lines 729-740 Link Here
729
#endif
743
#endif
730
744
731
static const char *asm_debug;
745
static const char *asm_debug;
732
static const char *cpp_spec = CPP_SPEC;
746
static const char *cpp_spec = CPP_SPEC GENTOO_HARDENED_GCC_CPP_SPEC;
733
static const char *cc1_spec = CC1_SPEC;
747
static const char *cc1_spec = CC1_SPEC GENTOO_HARDENED_GCC_CC1_SPEC;
734
static const char *cc1plus_spec = CC1PLUS_SPEC;
748
static const char *cc1plus_spec = CC1PLUS_SPEC;
735
static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
749
static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
736
static const char *link_ssp_spec = LINK_SSP_SPEC;
750
static const char *link_ssp_spec = LINK_SSP_SPEC;
737
static const char *asm_spec = ASM_SPEC;
751
static const char *asm_spec = ASM_SPEC GENTOO_HARDENED_GCC_ASM_SPEC;
738
static const char *asm_final_spec = ASM_FINAL_SPEC;
752
static const char *asm_final_spec = ASM_FINAL_SPEC;
739
static const char *link_spec = LINK_SPEC;
753
static const char *link_spec = LINK_SPEC;
740
static const char *lib_spec = LIB_SPEC;
754
static const char *lib_spec = LIB_SPEC;
(-)gcc-4.1.1.GENTOO_2006-10-08/gcc/hardened-stubs.h (+28 lines)
Line 0 Link Here
1
/* Copyright 1999-2006 Gentoo Foundation */
2
/* Distributed under the terms of the GNU General Public License v2 */
3
/* $Header: $ */
4
5
/* list of empty hardened specs stubs needed for gcc.c */
6
7
#ifndef LINUX_HARDENED_STUBS_H
8
# define LINUX_HARDENED_STUBS_H
9
# ifndef GENTOO_HARDENED_ASM_SPEC
10
#  define GENTOO_HARDENED_ASM_SPEC ""
11
# endif
12
# ifndef GENTOO_HARDENED_CC1_SPEC
13
#  define GENTOO_HARDENED_CC1_SPEC ""
14
# endif
15
# ifndef HAVE_LD_PIE
16
#  ifdef GENTOO_HARDENED_LINK_PIE_SPEC
17
#   undef GENTOO_HARDENED_LINK_PIE_SPEC
18
#  endif
19
#  define GENTOO_HARDENED_LINK_PIE_SPEC ""
20
# else
21
#  ifndef GENTOO_HARDENED_LINK_PIE_SPEC
22
#   define GENTOO_HARDENED_LINK_PIE_SPEC ""
23
#  endif
24
# endif
25
#endif
26
27
/* no stubs for startfile/endfile replacement specs in gcc.c */
28

Return to bug 149649