optflags: set _FORTIFY_SOURCE for preproc 99/31699/1
authorPhilippe Coval <philippe.coval@open.eurogiciel.org>
Mon, 8 Dec 2014 15:00:20 +0000 (16:00 +0100)
committerPhilippe Coval <philippe.coval@open.eurogiciel.org>
Mon, 8 Dec 2014 15:05:00 +0000 (16:05 +0100)
Without it will fail if optflags are not overridden
and raise an error like :

  configure: CFLAGS error: CFLAGS may only be used to specify C compiler flags, not macro definitions. Use CPPFLAGS for: -D_FORTIFY_SOURCE=2
  configure: error: Can not continue. Fix errors mentioned immediately above this line.
  error: Bad exit status from /var/tmp/rpm-tmp.AoOYbS (%build)

More details at :

https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Preprocessor-Options.html#index-Wp-986

Change-Id: I49c8545a0526a1922905ef55de3a59edf9036068
Signed-off-by: Philippe Coval <philippe.coval@open.eurogiciel.org>
rpmrc.in

index 30481b2..1962600 100644 (file)
--- a/rpmrc.in
+++ b/rpmrc.in
 # "fat" binary with both archs, for Darwin
 optflags: fat -O2 -g -arch i386 -arch ppc
 
-optflags: i386 -O2 -g -m32 -march=i486 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
-optflags: i486 -O2 -g -m32 -march=i486 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
-optflags: i586 -O2 -g -m32 -march=i586 -mtune=i686 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
-optflags: i686 -O2 -g -m32 -march=i686 -mtune=i686 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: i386 -O2 -g -m32 -march=i486 -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: i486 -O2 -g -m32 -march=i486 -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: i586 -O2 -g -m32 -march=i586 -mtune=i686 -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: i686 -O2 -g -m32 -march=i686 -mtune=i686 -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
 optflags: pentium3 -O2 -g -m32 -march=pentium3
 optflags: pentium4 -O2 -g -m32 -march=pentium4
 optflags: athlon -O2 -g -m32 -march=athlon
 optflags: geode -Os -g -m32 -march=geode
-optflags: ia64 -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
-optflags: x86_64 -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: ia64 -O2 -g -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: x86_64 -O2 -g -m64 -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
 optflags: amd64 -O2 -g
 optflags: ia32e -O2 -g
 
@@ -41,14 +41,14 @@ optflags: sparc64v -O2 -g -m64 -mtune=niagara
 
 optflags: m68k -O2 -g -fomit-frame-pointer
 
-optflags: ppc -O2 -g -m32 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: ppc -O2 -g -m32 -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
 optflags: ppc8260 -O2 -g -m32
 optflags: ppc8560 -O2 -g -m32
 optflags: ppc32dy4 -O2 -g -m32
 optflags: ppciseries -O2 -g -m32
 optflags: ppcpseries -O2 -g -m32
-optflags: ppc64 -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
-optflags: ppc64p7 -O3 -mtune=power7 -mcpu=power7 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: ppc64 -O2 -g -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: ppc64p7 -O3 -mtune=power7 -mcpu=power7 -g -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
 
 optflags: parisc -O2 -g -mpa-risc-1-0
 optflags: hppa -O2 -g -mpa-risc-1-0
@@ -78,8 +78,8 @@ optflags: atariclone -O2 -g -fomit-frame-pointer
 optflags: milan -O2 -g -fomit-frame-pointer
 optflags: hades -O2 -g -fomit-frame-pointer
 
-optflags: s390 -O2 -g -m31 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
-optflags: s390x -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: s390 -O2 -g -m31 -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: s390x -O2 -g -m64 -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
 
 optflags: sh3 -O2 -g
 optflags: sh4 -O2 -g -mieee