diff options
author | Magnus Granberg (Zorry) <zorry@gentoo.org> | 2010-05-06 00:52:59 +0200 |
---|---|---|
committer | Magnus Granberg (Zorry) <zorry@gentoo.org> | 2010-05-06 00:52:59 +0200 |
commit | 8f7896ddac9e0be82cbb0d758fc22bc572b1bc77 (patch) | |
tree | d84cf8ba0c33d44c36a9a5c9c902e310ce0fa0bf | |
parent | Added the doc to the warntrampolines patch (diff) | |
download | hardened-gccpatchset-8f7896ddac9e0be82cbb0d758fc22bc572b1bc77.tar.gz hardened-gccpatchset-8f7896ddac9e0be82cbb0d758fc22bc572b1bc77.tar.bz2 hardened-gccpatchset-8f7896ddac9e0be82cbb0d758fc22bc572b1bc77.zip |
Merge warntrampolines to one patch Wtrampolines.patch
-rw-r--r-- | upstream/warntrampolins/README | 3 | ||||
-rw-r--r-- | upstream/warntrampolins/Wtrampolines.patch | 133 | ||||
-rw-r--r-- | upstream/warntrampolins/gcc_builtins.c.patch | 13 | ||||
-rw-r--r-- | upstream/warntrampolins/gcc_common.opt.patch | 13 | ||||
-rw-r--r-- | upstream/warntrampolins/gcc_doc_invoke.texi.patch | 25 | ||||
-rw-r--r-- | upstream/warntrampolins/gcc_testsuite_gcc.dg_Wtrampolines.c.patch | 61 |
6 files changed, 133 insertions, 115 deletions
diff --git a/upstream/warntrampolins/README b/upstream/warntrampolins/README index a7b9afa..9c13059 100644 --- a/upstream/warntrampolins/README +++ b/upstream/warntrampolins/README @@ -6,6 +6,3 @@ Kevin F. Quinn <kevquinn@gentoo.org> 17 Jan 2006 Ported to GCC 4.5.x /Zorry - -gcc/doc/invoke.texi need more work i think. -/Zorry
\ No newline at end of file diff --git a/upstream/warntrampolins/Wtrampolines.patch b/upstream/warntrampolins/Wtrampolines.patch new file mode 100644 index 0000000..d1d311a --- /dev/null +++ b/upstream/warntrampolins/Wtrampolines.patch @@ -0,0 +1,133 @@ +gcc/ + +2010-05-06 Magnus Granberg <zorry@gentoo.org>, Kevin F. Quinn <kevquinn@gentoo.org> + + * builtins.c (expand_builtin_init_trampoline): if warn_trampolines make a warning. + * common.opt: Add -Wtrampolines. + +gcc/doc + +2010-05-06 Magnus Granberg <zorry@gentoo.org> + + * invoke.texi: Add -Wtrampolines. + +gcc/testsuite/ + +2010-05-06 Magnus Granberg <zorry@gentoo.org> + + * gcc.dg/Wtrampolines.c: New. + +--- gcc/builtins.c.zorry 2010-04-13 15:47:11.000000000 +0200 ++++ gcc/builtins.c 2010-04-25 22:45:49.000000000 +0200 +@@ -5150,6 +5150,10 @@ + targetm.calls.trampoline_init (m_tramp, t_func, r_chain); + + trampolines_created = 1; ++ ++ if (warn_trampolines) ++ warning (OPT_Wtrampolines, "generating trampoline in object (requires executable stack)"); ++ + return const0_rtx; + } + +--- gcc/common.opt.zorry 2010-03-18 04:01:09.000000000 +0100 ++++ gcc/common.opt 2010-05-06 00:44:18.000000000 +0200 +@@ -192,6 +192,12 @@ + Common Var(warn_system_headers) Warning + Do not suppress warnings from system headers + ++ ++Wtrampolines ++Common Var(warn_trampolines) Warnings ++Warn whenever a trampoline is generated ++ ++ + Wtype-limits + Common Var(warn_type_limits) Init(-1) Warning + Warn if a comparison is always true or always false due to the limited range of the data type +--- gcc/doc/invoke.texi.zorry 2010-04-06 16:02:22.000000000 +0200 ++++ gcc/doc/invoke.texi 2010-05-06 00:20:25.000000000 +0200 +@@ -258,8 +258,8 @@ + -Wstrict-aliasing -Wstrict-aliasing=n @gol + -Wstrict-overflow -Wstrict-overflow=@var{n} @gol + -Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol +--Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized @gol +--Wunknown-pragmas -Wno-pragmas @gol ++-Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol ++-Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol + -Wunsuffixed-float-constants -Wunused -Wunused-function @gol + -Wunused-label -Wunused-parameter -Wno-unused-result -Wunused-value -Wunused-variable @gol + -Wvariadic-macros -Wvla @gol +@@ -3603,6 +3603,12 @@ + option will @emph{not} warn about unknown pragmas in system + headers---for that, @option{-Wunknown-pragmas} must also be used. + ++@item -Wtrampolines ++@opindex Wtrampolines ++@opindex Wno-trampolines ++Make a warning when the compiler generating trampoline in object that ++requires executable stack. ++ + @item -Wfloat-equal + @opindex Wfloat-equal + @opindex Wno-float-equal +--- gcc/testsuite/gcc.dg/Wtrampolines.c.zorry 2010-05-05 12:53:11.000000000 +0200 ++++ gcc/testsuite/gcc.dg/Wtrampolines.c 2010-05-06 00:26:05.000000000 +0200 +@@ -0,0 +1,57 @@ ++/* Origin: trampoline-1.c Waldek Hebisch <hebisch@math.uni.wroc.pl> */ ++/* Ported to test -Wtrampolines Magnus Granberg <zorry@gentoo.org> */ ++ ++/* { dg-do compile } */ ++/* { dg-require-effective-target trampolines } */ ++/* { dg-options "-O2 -Wtrampolines" } */ ++ ++#ifndef NO_TRAMPOLINES ++ ++/* This used to fail on various versions of Solaris 2 because the ++ trampoline couldn't be made executable. */ ++ ++extern void abort(void); ++extern double fabs(double); ++ ++void foo (void) ++{ ++ const int correct[1100] = {1, 0, -2, 0, 1, 0, 1, -1, -10, -30, -67}; ++ int i; ++ ++ double x1 (void) {return 1; } ++ double x2 (void) {return -1;} ++ double x3 (void) {return -1;} ++ double x4 (void) {return 1; } ++ double x5 (void) {return 0; } ++ ++ typedef double pfun(void); ++ ++ double a (int k, pfun x1, pfun x2, pfun x3, pfun x4, pfun x5) /* { dg-warning "requires executable stack" } */ ++ { ++ double b (void) ++ { ++ k = k - 1; ++ return a (k, b, x1, x2, x3, x4 ); ++ } ++ ++ if (k <= 0) ++ return x4 () + x5 (); ++ else ++ return b (); ++ } ++ ++ for (i=0; i<=10; i++) ++ { ++ if (fabs(a( i, x1, x2, x3, x4, x5 ) - correct [i]) > 0.1) ++ abort(); ++ } ++} ++#endif ++ ++int main (void) ++{ ++#ifndef NO_TRAMPOLINES ++ foo (); ++#endif ++ return 0; ++} diff --git a/upstream/warntrampolins/gcc_builtins.c.patch b/upstream/warntrampolins/gcc_builtins.c.patch deleted file mode 100644 index d6d26dd..0000000 --- a/upstream/warntrampolins/gcc_builtins.c.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- gcc/builtins.c -+++ gcc/builtins.c -@@ -5150,6 +5150,10 @@ - targetm.calls.trampoline_init (m_tramp, t_func, r_chain); - - trampolines_created = 1; -+ -+ if (warn_trampolines) -+ warning (OPT_Wtrampolines, "generating trampoline in object (requires executable stack)"); -+ - return const0_rtx; - } -
\ No newline at end of file diff --git a/upstream/warntrampolins/gcc_common.opt.patch b/upstream/warntrampolins/gcc_common.opt.patch deleted file mode 100644 index 2d7f2fb..0000000 --- a/upstream/warntrampolins/gcc_common.opt.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- gcc/common.opt -+++ gcc/common.opt -@@ -141,6 +141,10 @@ - Common Var(warn_system_headers) - Do not suppress warnings from system headers - -+Wtrampolines -+Common Var(warn_trampolines) Warnings -+Warn whenever a trampoline is generated -+ - Wuninitialized - Common Var(warn_uninitialized) - Warn about uninitialized automatic variables diff --git a/upstream/warntrampolins/gcc_doc_invoke.texi.patch b/upstream/warntrampolins/gcc_doc_invoke.texi.patch deleted file mode 100644 index 196c51c..0000000 --- a/upstream/warntrampolins/gcc_doc_invoke.texi.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- gcc/doc/invoke.texi 2010-04-06 16:02:22.000000000 +0200 -+++ gcc/doc/invoke.texi 2010-05-05 13:23:24.000000000 +0200 -@@ -258,8 +258,8 @@ - -Wstrict-aliasing -Wstrict-aliasing=n @gol - -Wstrict-overflow -Wstrict-overflow=@var{n} @gol - -Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol ---Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized @gol ---Wunknown-pragmas -Wno-pragmas @gol -+-Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol -+-Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol - -Wunsuffixed-float-constants -Wunused -Wunused-function @gol - -Wunused-label -Wunused-parameter -Wno-unused-result -Wunused-value -Wunused-variable @gol - -Wvariadic-macros -Wvla @gol -@@ -3603,6 +3603,11 @@ - option will @emph{not} warn about unknown pragmas in system - headers---for that, @option{-Wunknown-pragmas} must also be used. - -+@item -Wtrampolines -+@opindex Wtrampolines -+@opindex Wno-trampolines -+Warn whenever a trampoline is generated -+ - @item -Wfloat-equal - @opindex Wfloat-equal - @opindex Wno-float-equal diff --git a/upstream/warntrampolins/gcc_testsuite_gcc.dg_Wtrampolines.c.patch b/upstream/warntrampolins/gcc_testsuite_gcc.dg_Wtrampolines.c.patch deleted file mode 100644 index 4dbe34c..0000000 --- a/upstream/warntrampolins/gcc_testsuite_gcc.dg_Wtrampolines.c.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- gcc/testsuite/gcc.dg/Wtrampolines.c 2010-05-05 12:53:11.000000000 +0200 -+++ gcc/testsuite/gcc.dg/Wtrampolines.c 2010-05-05 12:50:06.000000000 +0200 -@@ -0,0 +1,58 @@ -+/* PR target/12865 */ -+/* Origin: Waldek Hebisch <hebisch@math.uni.wroc.pl> */ -+/* Test -Wtrampolines */ -+ -+/* { dg-do compile } */ -+/* { dg-require-effective-target trampolines } */ -+/* { dg-options "-O2 -Wtrampolines" } */ -+ -+#ifndef NO_TRAMPOLINES -+ -+/* This used to fail on various versions of Solaris 2 because the -+ trampoline couldn't be made executable. */ -+ -+extern void abort(void); -+extern double fabs(double); -+ -+void foo (void) -+{ -+ const int correct[1100] = {1, 0, -2, 0, 1, 0, 1, -1, -10, -30, -67}; -+ int i; -+ -+ double x1 (void) {return 1; } -+ double x2 (void) {return -1;} -+ double x3 (void) {return -1;} -+ double x4 (void) {return 1; } -+ double x5 (void) {return 0; } -+ -+ typedef double pfun(void); -+ -+ double a (int k, pfun x1, pfun x2, pfun x3, pfun x4, pfun x5) /* { dg-warning "requires executable stack" } */ -+ { -+ double b (void) -+ { -+ k = k - 1; -+ return a (k, b, x1, x2, x3, x4 ); -+ } -+ -+ if (k <= 0) -+ return x4 () + x5 (); -+ else -+ return b (); -+ } -+ -+ for (i=0; i<=10; i++) -+ { -+ if (fabs(a( i, x1, x2, x3, x4, x5 ) - correct [i]) > 0.1) -+ abort(); -+ } -+} -+#endif -+ -+int main (void) -+{ -+#ifndef NO_TRAMPOLINES -+ foo (); -+#endif -+ return 0; -+} |