PIEExperimentSpec
Attachment 'always-on-pie.patch'
Download 1 diff -ur src-base/gcc/common.opt src/gcc/common.opt
2 --- src-base/gcc/common.opt 2008-09-06 01:45:01.000000000 -0400
3 +++ src/gcc/common.opt 2008-09-06 01:48:39.000000000 -0400
4 @@ -766,7 +766,7 @@
5 Generate position-independent code if possible (large mode)
6
7 fPIE
8 -Common Report Var(flag_pie,2)
9 +Common Report Var(flag_pie,2) Init(2)
10 Generate position-independent code for executables if possible (large mode)
11
12 fpic
13 diff -ur src-base/gcc/config/i386/linux64.h src/gcc/config/i386/linux64.h
14 --- src-base/gcc/config/i386/linux64.h 2008-09-06 01:44:39.000000000 -0400
15 +++ src/gcc/config/i386/linux64.h 2008-09-06 04:02:16.000000000 -0400
16 @@ -53,8 +53,8 @@
17 When the -shared link option is used a final link is not being
18 done. */
19
20 -#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
21 -#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
22 +#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-linux.so.2"
23 +#define GLIBC_DYNAMIC_LINKER64 "/tools/lib/ld-linux-x86-64.so.2"
24
25 #if TARGET_64BIT_DEFAULT
26 #define SPEC_32 "m32"
27 @@ -81,7 +81,7 @@
28 %{mpc32:crtprec32.o%s} \
29 %{mpc64:crtprec64.o%s} \
30 %{mpc80:crtprec80.o%s} \
31 - %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
32 + %{shared|pie:crtendS.o%s;static|nopie|pg|p|profile:crtend.o%s;:crtendS.o%s} crtn.o%s"
33
34 #if TARGET_64BIT_DEFAULT
35 #define MULTILIB_DEFAULTS { "m64" }
36 diff -ur src-base/gcc/config/i386/linux.h src/gcc/config/i386/linux.h
37 --- src-base/gcc/config/i386/linux.h 2008-09-06 01:44:39.000000000 -0400
38 +++ src/gcc/config/i386/linux.h 2008-09-06 01:59:05.000000000 -0400
39 @@ -100,7 +100,7 @@
40
41 /* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
42 #define LINK_EMULATION "elf_i386"
43 -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
44 +#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
45
46 #undef SUBTARGET_EXTRA_SPECS
47 #define SUBTARGET_EXTRA_SPECS \
48 @@ -123,7 +123,7 @@
49 %{mpc32:crtprec32.o%s} \
50 %{mpc64:crtprec64.o%s} \
51 %{mpc80:crtprec80.o%s} \
52 - %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
53 + %{shared|pie:crtendS.o%s;static|nopie|pg|p|profile:crtend.o%s;:crtendS.o%s} crtn.o%s"
54
55 /* A C statement (sans semicolon) to output to the stdio stream
56 FILE the assembler definition of uninitialized global DECL named
57 Only in src/gcc/config/i386: linux.h.orig
58 diff -ur src-base/gcc/config/linux.h src/gcc/config/linux.h
59 --- src-base/gcc/config/linux.h 2008-09-06 01:44:40.000000000 -0400
60 +++ src/gcc/config/linux.h 2008-09-06 02:00:03.000000000 -0400
61 @@ -40,8 +40,9 @@
62 #undef STARTFILE_SPEC
63 #if defined HAVE_LD_PIE
64 #define STARTFILE_SPEC \
65 - "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
66 - crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
67 + "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;static|nopie:crt1.o%s;: \
68 + Scrt1.o%s}} crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s; \
69 + nopie|pg|p|profile:crtbegin.o%s;:crtbeginS.o%s}"
70 #else
71 #define STARTFILE_SPEC \
72 "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
73 @@ -130,3 +131,5 @@
74 #define TARGET_HAS_SINCOS (OPTION_GLIBC)
75
76 #define TARGET_POSIX_IO
77 +#undef STANDARD_INCLUDE_DIR
78 +#define STANDARD_INCLUDE_DIR 0
79 Only in src/gcc/config: linux.h.orig
80 diff -ur src-base/gcc/gcc.c src/gcc/gcc.c
81 --- src-base/gcc/gcc.c 2008-09-06 01:43:44.000000000 -0400
82 +++ src/gcc/gcc.c 2008-09-06 01:53:24.000000000 -0400
83 @@ -714,7 +714,8 @@
84
85 #ifndef LINK_PIE_SPEC
86 #ifdef HAVE_LD_PIE
87 -#define LINK_PIE_SPEC "%{pie:-pie} "
88 +#define LINK_PIE_SPEC "%{pie:-pie} \
89 + %{static|Bstatic|shared|Bshareable|i|r|pie|nopie:;:-pie} "
90 #else
91 #define LINK_PIE_SPEC "%{pie:} "
92 #endif
93 @@ -822,6 +823,9 @@
94 in turn cause preprocessor symbols to be defined specially. */
95 static const char *cpp_options =
96 "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
97 + %{fpic|fPIC|fpie|static|D__KERNEL__:-fno-PIE}\
98 + %{shared|nostdlib|nostartfiles:-fno-PIE -fPIC}\
99 + %{static:%{pie:%e-static and -pie are incompatible}}\
100 %{f*} %{g*:%{!g0:%{!fno-working-directory:-fworking-directory}}} %{O*}\
101 %{undef} %{save-temps:-fpch-preprocess}";
102
103 diff -ur src-base/gcc/Makefile.in src/gcc/Makefile.in
104 --- src-base/gcc/Makefile.in 2008-09-06 01:44:54.000000000 -0400
105 +++ src/gcc/Makefile.in 2008-09-06 01:58:57.000000000 -0400
106 @@ -564,7 +564,7 @@
107 LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \
108 $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \
109 -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
110 - -fno-stack-protector \
111 + -fno-stack-protector -fno-PIE \
112 $(INHIBIT_LIBC_CFLAGS)
113
114 # Additional options to use when compiling libgcc2.a.
115 @@ -578,7 +578,7 @@
116 CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
117 -finhibit-size-directive -fno-inline-functions -fno-exceptions \
118 -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
119 - -fno-stack-protector \
120 + -fno-stack-protector -fno-PIE \
121 $(INHIBIT_LIBC_CFLAGS)
122
123 # Additional sources to handle exceptions; overridden by targets as needed.
124 @@ -3511,7 +3511,7 @@
125 SHELL='$(SHELL)'; MACRO_LIST=`${PWD_COMMAND}`/macro_list ; \
126 export TARGET_MACHINE srcdir SHELL MACRO_LIST && \
127 cd $(build_objdir)/fixincludes && \
128 - $(SHELL) ./fixinc.sh ../../gcc/$${fix_dir} \
129 + $(SHELL) -c true ../../gcc/$${fix_dir} \
130 $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \
131 rm -f $${fix_dir}/syslimits.h; \
132 if [ -f $${fix_dir}/limits.h ]; then \
133 Only in src/gcc: Makefile.in.orig2
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.