Patch: testsuite-espf-format.patch
Add -Wno-format if check_effective_target_espf to some testfiles.

Patch: testsuite-espf-fortify.patch
Add check_effective_target_espf.
New files for some of the testfiles so we can disable FORTIFY_SOURCE.

Patch: testsuite-espf-piessp.patch
Add -fno-PIE or -fno-stack-proctor if check_effective_target_espf.

Gentoo Hardened Project
Magnus Granberg
--- a/gcc/testsuite/gcc.dg/charset/builtin2.c
+++ b/gcc/testsuite/gcc.dg/charset/builtin2.c
@@ -4,6 +4,7 @@
 /* { dg-do compile } */
 /* { dg-require-iconv "IBM1047" } */
 /* { dg-options "-O2 -fexec-charset=IBM1047" } */
+/* { dg-additional-options "-Wno-format" { target espf } } */
 /* { dg-final { scan-assembler-not "printf" } } */
 /* { dg-final { scan-assembler-not "fprintf" } } */
 /* { dg-final { scan-assembler-not "sprintf" } } */
--- a/gcc/testsuite/gcc.dg/format/format.exp
+++ b/gcc/testsuite/gcc.dg/format/format.exp
@@ -24,9 +24,16 @@ if [is_remote host] {
 
 load_lib gcc-dg.exp
 load_lib torture-options.exp
+load_lib target-supports.exp
 
 torture-init
-set-torture-options [list { } { -DWIDE } ]
+
+# Disable -Wformat if we use espf.
+if  [check_effective_target_espf] {
+	set-torture-options [list { -Wno-format } { -DWIDE -Wno-format } ]
+} else {
+	set-torture-options [list { } { -DWIDE } ]
+}
 
 dg-init
 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] ""

--- a/gcc/testsuite/gcc.dg/pr30473.c
+++ b/gcc/testsuite/gcc.dg/pr30473.c
@@ -2,6 +2,7 @@
 /* Make sure this doesn't ICE.  */
 /* { dg-do compile } */
 /* { dg-options "-O2" } */
+/* { dg-additional-options "Wno-format" { target espf } } */
 
 extern int sprintf (char *, const char *, ...);
 
--- a/gcc/testsuite/gcc.dg/pr38902.c
+++ b/gcc/testsuite/gcc.dg/pr38902.c
@@ -2,6 +2,7 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -fstack-protector" } */
 /* { dg-require-effective-target fstack_protector } */
+/* { dg-additional-options "Wno-format" { target espf } } */
 
 #ifdef DEBUG
 #include <stdio.h>
--- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c	2010-09-10 01:38:23.000000000 +0200
+++b/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c	2012-07-31 14:37:53.238554197 +0200
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details"  } */
+/* { dg-additional-options "-Wno-format" { target espf } } */
 
 struct bovid
 {
--- a/gcc/testsuite/gcc.dg/torture/tls/tls-test.c	2011-06-22 19:27:07.000000000 +0200
+++ b/gcc/testsuite/gcc.dg/torture/tls/tls-test.c	2012-08-21 23:51:33.205398132 +0200
@@ -2,6 +2,7 @@
 /* { dg-require-effective-target tls  }  */
 /* { dg-require-effective-target pthread } */
 /* { dg-options "-pthread" } */
+/* { dg-additional-options "-Wno-format" { target espf } } */
 
 #include <pthread.h>
 extern int printf (char *,...);
--- a/gcc/testsuite/g++.dg/abi/pragma-pack1.C	2011-06-07 23:54:07.000000000 +0200
+++ b/gcc/testsuite/g++.dg/abi/pragma-pack1.C	2012-08-16 17:49:19.472877085 +0200
@@ -1,4 +1,5 @@
 // PR c++/7046
+// { dg-additional-options "-Wno-format" { target espf } }
 
 extern "C" int printf (const char *, ...);
 
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-tuple.C	2012-08-16 17:41:19.486862781 +0200
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-tuple.C	2012-08-16 17:38:38.000000000 +0200
@@ -1,5 +1,6 @@
 // PR c++/53202
 // { dg-do run { target c++11 } }
+// { dg-additional-options "-Wno-format" { target espf } }
 
 #include <tuple>
 
--- a/gcc/testsuite/lib/target-supports.exp	2012-02-22 12:00:21.000000000 +0100
+++ b/gcc/testsuite/lib/target-supports.exp	2012-07-27 19:19:30.849216278 +0200
@@ -4419,6 +4419,14 @@ proc check_effective_target_lto { } {
     return [info exists ENABLE_LTO]
 }
 
+# Return 1 if the compiler has been configure with espf
+# (configure --enable-espf=(all|ssp|pie)) support.
+
+proc check_effective_target_espf { } {
+    global ENABLE_ESPF
+    return [info exists ENABLE_ESPF]
+}
+
 # Return 1 if this target supports the -fsplit-stack option, 0
 # otherwise.
 
--- a/gcc/testsuite/gcc.c-torture/execute/memset-1.x	2012-08-18 14:43:31.963694252 +0200
+++ b/gcc/testsuite/gcc.c-torture/execute/memset-1.x	2012-07-27 21:47:01.000000000 +0200
@@ -0,0 +1,6 @@
+load_lib target-supports.exp
+
+if { [check_effective_target_espf] } {
+        set additional_flags "-U_FORTIFY_SOURCE"
+}
+return 0
--- a/gcc/testsuite/gcc.c-torture/execute/vprintf-chk-1.x	2012-07-30 02:31:20.573793905 +0200
+++ b/gcc/testsuite/gcc.c-torture/execute/vprintf-chk-1.x	2012-07-27 21:47:01.574480025 +0200
@@ -0,0 +1,6 @@
+load_lib target-supports.exp
+
+if [check_effective_target_espf] {
+        set additional_flags "-U_FORTIFY_SOURCE"
+}
+return 0
--- a/gcc/testsuite/gcc.c-torture/execute/vfprintf-chk-1.x	2012-07-30 02:31:07.366794031 +0200
+++ b/gcc/testsuite/gcc.c-torture/execute/vfprintf-chk-1.x	2012-07-27 21:47:01.000000000 +0200
@@ -0,0 +1,6 @@
+load_lib target-supports.exp
+
+if [check_effective_target_espf] {
+        set additional_flags "-U_FORTIFY_SOURCE"
+}
+return 0
--- a/gcc/testsuite/gcc.dg/20021014-1.c	2009-10-02 01:08:07.000000000 +0200
+++ b/gcc/testsuite/gcc.dg/20021014-1.c	2012-08-14 23:50:16.724373103 +0200
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-require-profiling "-p" } */
 /* { dg-options "-O2 -p" } */
+/* { dg-additional-options "-fno-PIE" { target espf } } */
 /* { dg-options "-O2 -p -static" { target hppa*-*-hpux* } } */
 /* { dg-error "profiler" "No profiler support" { target xstormy16-*-* } 0 } */
 /* { dg-message "" "consider using `-pg' instead of `-p' with gprof(1)" { target *-*-freebsd* } 0 } */
--- a/gcc/testsuite/gcc.dg/nest.c	2007-08-30 07:23:02.000000000 +0200
+++ b/gcc/testsuite/gcc.dg/nest.c	2012-08-14 23:51:44.797375728 +0200
@@ -3,6 +3,7 @@
 /* { dg-require-profiling "-pg" } */
 /* { dg-options "-O2 -pg" } */
 /* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */
+/* { dg-additional-options "-fno-PIE" { target espf } } */
 /* { dg-error "profiler" "No profiler support" { target xstormy16-*-* } 0 } */
 
 extern void abort (void);
--- a/gcc/testsuite/gcc.dg/nested-func-4.c	2007-08-30 07:23:02.000000000 +0200
+++ b/gcc/testsuite/gcc.dg/nested-func-4.c	2012-08-14 23:52:23.337376877 +0200
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-options "-pg" } */
 /* { dg-options "-pg -static" { target hppa*-*-hpux* } } */
+/* { dg-additional-options "-fno-PIE" { target espf } } */
 /* { dg-require-profiling "-pg" } */
 
 extern void abort(void);
--- a/gcc/testsuite/gcc.dg/pr32450.c	2007-08-30 07:23:02.000000000 +0200
+++ b/gcc/testsuite/gcc.dg/pr32450.c	2012-08-14 23:53:38.125379106 +0200
@@ -5,6 +5,7 @@
 /* { dg-options "-O2 -pg" } */
 /* { dg-options "-O2 -pg -mtune=core2" { target { i?86-*-* x86_64-*-* } } } */
 /* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */
+/* { dg-additional-options "-fno-PIE" { target espf } } */
 
 extern void abort (void);
 
--- a/gcc/testsuite/gcc.dg/pr43643.c	2010-04-14 18:47:15.000000000 +0200
+++ b/gcc/testsuite/gcc.dg/pr43643.c	2012-08-14 23:54:20.084380356 +0200
@@ -4,6 +4,7 @@
 /* { dg-require-profiling "-pg" } */
 /* { dg-options "-O2 -pg" } */
 /* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */
+/* { dg-additional-options "-fno-PIE" { target espf } } */
 
 extern char *strdup (const char *);
 
--- a/gcc.dg/tree-ssa/ssa-store-ccp-3.c	2011-08-07 09:45:57.000000000 +0200
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-3.c	2012-08-14 23:59:24.489389427 +0200
@@ -3,6 +3,7 @@
    defined for executables as well as shared libraries.  */
 /* { dg-skip-if "" { *-*-darwin* hppa*64*-*-* mips*-*-linux* mips*-*-irix* *-*-mingw* } { "*" } { "" } } */
 /* { dg-options "-O2 -fno-common -fdump-tree-optimized" } */
+/* { dg-skip-if "" { espf } { "*" } { "" } } */ */
 
 const int conststaticvariable;
 
--- a/gcc/testsuite/gcc.dg/stack-usage-1.c	2012-02-23 19:10:53.000000000 +0100
+++ b/gcc/testsuite/gcc.dg/stack-usage-1.c	2012-08-14 23:55:37.558382664 +0200
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-fstack-usage" } */
+/* { dg-additional-options "-fno-stack-protector" { target espf } } */
 
 /* This is aimed at testing basic support for -fstack-usage in the back-ends.
    See the SPARC back-end for example (grep flag_stack_usage_info in sparc.c).
--- a/gcc/testsuite/gcc.dg/superblock.c	2012-08-15 00:28:32.995441532 +0200
+++ b/gcc/testsuite/gcc.dg/superblock.c	2012-08-14 23:56:30.159384232 +0200
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fno-asynchronous-unwind-tables -fsched2-use-superblocks -fdump-rtl-sched2 -fdump-rtl-bbro" } */
+/* { dg-additional-options "-fno-stack-protector" { target espf } } */
 
 typedef int aligned __attribute__ ((aligned (64)));
 extern void abort (void);
--- a/gcc/testsuite/g++.dg/other/anon5.C	2012-08-16 17:33:08.842848160 +0200
+++ b/gcc/testsuite/g++.dg/other/anon5.C	2012-08-16 17:33:35.913848967 +0200
@@ -1,6 +1,7 @@
 // PR c++/34094
 // { dg-do link { target { ! { *-*-darwin* *-*-hpux* *-*-solaris2.* alpha*-dec-osf* mips-sgi-irix* } } } }
 // { dg-options "-g" }
+// { dg-additional-options "-fno-PIE" { target espf } }
 
 namespace {
   struct c
--- a/gcc/testsuite/g++.old-deja/g++.law/profile1.C	2007-08-30 07:23:02.000000000 +0200
+++ b/gcc/testsuite/g++.old-deja/g++.law/profile1.C	2012-08-21 20:48:15.463070406 +0200
@@ -2,6 +2,7 @@
 // { dg-require-profiling "-pg" }
 // { dg-options "-pg" }
 // { dg-options "-pg -static" { target hppa*-*-hpux* } }
+// { dg-additional-options "-fno-PIE" { target espf } }
 // GROUPS passed profiling
 #include <stdio.h>
 main()

Reply via email to