2009-10-04 Magnus Granberg * Makefile.in We add -fno-stack-protector to BOOT_CFLAGS, LIBCFLAGS and LIBCXXFLAGS. * gcc/Makefile.in Add -fno-PIE and -fno-stack-protector. Libgcc2 doesn't compile with -fstack-protector. Crtstuff doesn't compile with -fPIE and -fstack-protector. --- Makefile.in 2009-04-25 06:10:29.000000000 +0200 +++ Makefile.in 2009-10-04 00:58:25.000000000 +0200 @@ -1,4 +1,3 @@ - # Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'. # # Makefile for directory with subdirs to build. @@ -305,9 +304,12 @@ BUILD_PREFIX = @BUILD_PREFIX@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@ +# Disable SSP if GCC use SSP to build with. +ESPF_NOSSP_CFLAGS = -fno-stack-protector + # 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 $(ESPF_NOSSP_CFLAGS) BOOT_LDFLAGS= BOOT_ADAFLAGS=-gnatpg -gnata @@ -350,9 +352,9 @@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ -LIBCFLAGS = $(CFLAGS) +LIBCFLAGS = $(CFLAGS) $(ESPF_NOSSP_CFLAGS) CXXFLAGS = @CXXFLAGS@ -LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates +LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates $(ESPF_NOSSP_CFLAGS) # Only build the C compiler for stage1, because that is the only one that # we can guarantee will build with the native compiler, and also it is the --- gcc/Makefile.in 2009-05-22 01:17:37.000000000 +0200 +++ gcc/Makefile.in 2009-10-04 01:20:27.000000000 +0200 @@ -580,13 +580,18 @@ INHIBIT_LIBC_CFLAGS = -Dinhibit_libc endif +# We don't want __stack_chk_fail in crt* and libgcc2.a. +# We don't want to compile crtbegin, crtend and crtbeginT with -fPIE. +ESPF_NOPIE_CFLAGS = -fno-PIE +ESPF_NOSSP_CFLAGS = -fno-stack-protector + # Options to use when compiling libgcc2.a. # LIBGCC2_DEBUG_CFLAGS = -g LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \ $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \ -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ - $(INHIBIT_LIBC_CFLAGS) + $(INHIBIT_LIBC_CFLAGS) $(ESPF_NOSSP_CFLAGS) # Additional options to use when compiling libgcc2.a. # Some targets override this to -isystem include @@ -599,7 +604,7 @@ CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ -finhibit-size-directive -fno-inline-functions -fno-exceptions \ -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ - $(INHIBIT_LIBC_CFLAGS) + $(INHIBIT_LIBC_CFLAGS) $(ESPF_NOSSP_CFLAGS) # Additional sources to handle exceptions; overridden by targets as needed. LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ @@ -1719,7 +1724,7 @@ 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) $(ESPF_NOPIE_CFLAGS)' >> tmp-libgcc.mvars echo CRTSTUFF_T_CFLAGS_S = '$(CRTSTUFF_T_CFLAGS_S)' >> tmp-libgcc.mvars mv tmp-libgcc.mvars libgcc.mvars @@ -1754,12 +1759,14 @@ $(T)crtbegin.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) \ + $(ESPF_NOPIE_CFLAGS) \ -c $(srcdir)/crtstuff.c -DCRT_BEGIN \ -o $(T)crtbegin$(objext) $(T)crtend.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) \ + $(ESPF_NOPIE_CFLAGS) \ -c $(srcdir)/crtstuff.c -DCRT_END \ -o $(T)crtend$(objext) @@ -1780,6 +1787,7 @@ $(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) \ + $(ESPF_NOPIE_CFLAGS) \ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \ -o $(T)crtbeginT$(objext)