aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.6.0/piepatch/12_all_gcc46_Makefile.in.patch')
-rw-r--r--gcc-4.6.0/piepatch/12_all_gcc46_Makefile.in.patch151
1 files changed, 151 insertions, 0 deletions
diff --git a/gcc-4.6.0/piepatch/12_all_gcc46_Makefile.in.patch b/gcc-4.6.0/piepatch/12_all_gcc46_Makefile.in.patch
new file mode 100644
index 0000000..b17c0be
--- /dev/null
+++ b/gcc-4.6.0/piepatch/12_all_gcc46_Makefile.in.patch
@@ -0,0 +1,151 @@
+2011-01-01 Magnus Granberg <zorry@gentoo.org> Anthony G. Basile <basile@opensource.dyc.edu>
+
+ * Makefile.in We add -fno-stack-protector to BOOT_CFLAGS, LIBCFLAGS and LIBCXXFLAGS if enable_esp yes.
+ * gcc/Makefile.in Add -fno-PIE. to CRTSTUFF_CFLAGS and ALL_CFLAGS if enable_esp yes
+ Add crtbeginTS.o to EXTRA_PARTS if enable_crtbeginTS yes
+ We add new file crtbeginTS.o if enable_crtbeginTS yes
+ * libgcc/Makefile.in Add crtbeginTS.o to EXTRA_PARTS if enable_crtbeginTS yes
+ We add new file crtbeginTS.o if enable_crtbeginTS yes
+
+--- Makefile.in 2010-01-22 08:35:38.000000000 -0500
++++ Makefile.in 2010-02-07 15:10:59.000000000 -0500
+@@ -350,9 +350,17 @@
+ BUILD_PREFIX = @BUILD_PREFIX@
+ BUILD_PREFIX_1 = @BUILD_PREFIX_1@
+
++# Some stuff don't compile with SSP
++enable_esp = @enable_esp@
++ifeq ($(enable_esp),yes)
++ESP_NOSSP_CFLAGS = -fno-stack-protector
++else
++ESP_NOSSP_CFLAGS=
++endif
++
+ # Flags to pass to stage2 and later makes. They are defined
+ # here so that they can be overridden by Makefile fragments.
+-BOOT_CFLAGS= -g -O2
++BOOT_CFLAGS= -g -O2 $(ESP_NOSSP_CFLAGS)
+ BOOT_LDFLAGS=
+ BOOT_ADAFLAGS=-gnatpg -gnata
+
+@@ -403,9 +403,9 @@
+
+ CFLAGS = @CFLAGS@
+ LDFLAGS = @LDFLAGS@
+-LIBCFLAGS = $(CFLAGS)
++LIBCFLAGS = $(CFLAGS) $(ESP_NOSSP_CFLAGS)
+ CXXFLAGS = @CXXFLAGS@
+-LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
++LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates $(ESP_NOSSP_CFLAGS)
+ GOCFLAGS = $(CFLAGS)
+
+ TFLAGS =
+--- gcc/Makefile.in 2010-01-22 17:22:51.000000000 -0500
++++ gcc/Makefile.in 2010-02-07 15:15:13.000000000 -0500
+@@ -642,6 +642,14 @@
+ INHIBIT_LIBC_CFLAGS = -Dinhibit_libc
+ endif
+
++# We don't want to compile the compiler with -fPIE.
++enable_esp = @enable_esp@
++ifeq ($(enable_esp),yes)
++ESP_NOPIE_CFLAGS = -fno-PIE
++else
++ESP_NOPIE_CFLAGS=
++endif
++
+ # Options to use when compiling libgcc2.a.
+ #
+ LIBGCC2_DEBUG_CFLAGS = -g
+@@ -662,7 +670,7 @@
+ CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
+ -finhibit-size-directive -fno-inline -fno-exceptions \
+ -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
+- -fno-stack-protector \
++ -fno-stack-protector $(ESP_NOPIE_CFLAGS) \
+ $(INHIBIT_LIBC_CFLAGS)
+
+ # Additional sources to handle exceptions; overridden by targets as needed.
+@@ -678,6 +689,12 @@
+ # The rules for compiling them should be in the t-* file for the machine.
+ EXTRA_PARTS = @extra_parts@
+
++# We add crtbeginTS.o to the EXTRA_PARTS list if enable_crtbeginTS = yes
++enable_crtbeginTS = @enable_crtbeginTS@
++ifeq ($(enable_crtbeginTS),yes)
++EXTRA_PARTS += crtbeginTS.o
++endif
++
+ # List of extra object files that should be compiled and linked with
+ # compiler proper (cc1, cc1obj, cc1plus).
+ EXTRA_OBJS = @extra_objs@
+@@ -998,7 +1006,7 @@
+
+ # This is the variable actually used when we compile. If you change this,
+ # you probably want to update BUILD_CFLAGS in configure.ac
+-ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \
++ALL_CFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) \
+ $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@
+
+ # The C++ version.
+@@ -1856,9 +1873,10 @@
+ echo LIBGCC_SYNC = '$(LIBGCC_SYNC)' >> tmp-libgcc.mvars
+ echo LIBGCC_SYNC_CFLAGS = '$(LIBGCC_SYNC_CFLAGS)' >> tmp-libgcc.mvars
+ echo CRTSTUFF_CFLAGS = '$(CRTSTUFF_CFLAGS)' >> tmp-libgcc.mvars
+- echo CRTSTUFF_T_CFLAGS = '$(CRTSTUFF_T_CFLAGS)' >> tmp-libgcc.mvars
++ echo CRTSTUFF_T_CFLAGS = '$(CRTSTUFF_T_CFLAGS) $(ESP_NOPIE_CFLAGS)' >> tmp-libgcc.mvars
+ echo CRTSTUFF_T_CFLAGS_S = '$(CRTSTUFF_T_CFLAGS_S)' >> tmp-libgcc.mvars
+ echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars
++ echo enable_crtbeginTS = '$(enable_crtbeginTS)' >> tmp-libgcc.mvars
+
+ mv tmp-libgcc.mvars libgcc.mvars
+
+@@ -1918,9 +1938,19 @@
+ $(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
+ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
++ $(ESP_NOPIE_CFLAGS) \
+ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \
+ -o $(T)crtbeginT$(objext)
+
++# This is a version of crtbegin for -static -fPIE links if esp is enable.
++ifeq ($(enable_crtbeginTS),yes)
++$(T)crtbeginTS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
++ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
++ $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
++ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O \
++ -o $(T)crtbeginTS$(objext)
++endif
++
+ # Compile the start modules crt0.o and mcrt0.o that are linked with
+ # every program
+ $(T)crt0.o: s-crt0 ; @true
+--- libgcc/Makefile.in 2009-07-30 18:33:49.000000000 -0400
++++ libgcc/Makefile.in 2010-02-07 15:10:59.000000000 -0500
+@@ -291,6 +291,12 @@
+ gen-hide-list = echo > \$@
+ endif
+
++# We add crtbeginTS.o to the EXTRA_PARTS list if enable_crtbeginTS = yes
++enable_libgcc_crtbeginTS = $(enable_crtbeginTS)
++ifeq ($(enable_libgcc_crtbeginTS),yes)
++EXTRA_PARTS += crtbeginTS.o
++endif
++
+ ifneq ($(EXTRA_PARTS),)
+ extra-parts = libgcc-extra-parts
+ INSTALL_PARTS = $(EXTRA_PARTS)
+@@ -842,6 +848,13 @@
+ crtbeginT.o: $(gcc_srcdir)/crtstuff.c
+ $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
+ -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O
++
++# This is a version of crtbegin for -static -fPIE links.
++ifeq ($(enable_libgcc_crtbeginTS),yes)
++crtbeginTS.o: $(gcc_srcdir)/crtstuff.c
++ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
++ -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O
++endif
+ endif
+
+ # Build extra startfiles in the libgcc directory.