diff options
author | Gerald Pfeifer <gerald@FreeBSD.org> | 2016-11-20 09:15:19 +0000 |
---|---|---|
committer | Gerald Pfeifer <gerald@FreeBSD.org> | 2016-11-20 09:15:19 +0000 |
commit | 64bbcf8b752771c4cfd64dfa9cfd5d59bbd977b4 (patch) | |
tree | dd835cb195359d059a3ab106da0ccac9bfc0c71f /lang/gcc/files/patch-stackprotector-gcc_testsuite | |
parent | - Switch to options helpers (diff) |
Long awaited, finally update the default version of GCC in the Ports
Collection as well as the lang/gcc port from GCC 4.8.5 to GCC 4.9.4!
See http://gcc.gnu.org/gcc-4.9/changes.html for an extensive list of
changes and http://gcc.gnu.org/gcc-4.9/porting_to.html for information
on how to port to that new version (if necessary).
files/java-patch-hier required adjustments, gcc/files/patch-arm-libcpp
is not needed any longer (merged upstream), and we're also loosing the
local Stack Protector patches/backports.
PR: 196712
Tested by: antoine (-exp runs)
Supported by: antoine, kwm, and others
Diffstat (limited to 'lang/gcc/files/patch-stackprotector-gcc_testsuite')
-rw-r--r-- | lang/gcc/files/patch-stackprotector-gcc_testsuite | 176 |
1 files changed, 0 insertions, 176 deletions
diff --git a/lang/gcc/files/patch-stackprotector-gcc_testsuite b/lang/gcc/files/patch-stackprotector-gcc_testsuite deleted file mode 100644 index 443a7b4ef893..000000000000 --- a/lang/gcc/files/patch-stackprotector-gcc_testsuite +++ /dev/null @@ -1,176 +0,0 @@ ---- /dev/null -+++ gcc/testsuite/g++.dg/fstack-protector-strong.C -@@ -0,0 +1,35 @@ -+/* Test that stack protection is done on chosen functions. */ -+ -+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -+/* { dg-options "-O2 -fstack-protector-strong" } */ -+ -+class A -+{ -+public: -+ A() {} -+ ~A() {} -+ void method(); -+ int state; -+}; -+ -+/* Frame address exposed to A::method via "this". */ -+int -+foo1 () -+{ -+ A a; -+ a.method (); -+ return a.state; -+} -+ -+/* Possible destroying foo2's stack via &a. */ -+int -+global_func (A& a); -+ -+/* Frame address exposed to global_func. */ -+int foo2 () -+{ -+ A a; -+ return global_func (a); -+} -+ -+/* { dg-final { scan-assembler-times "stack_chk_fail" 2 } } */ ---- /dev/null -+++ gcc/testsuite/gcc.dg/fstack-protector-strong.c -@@ -0,0 +1,135 @@ -+/* Test that stack protection is done on chosen functions. */ -+ -+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -+/* { dg-options "-O2 -fstack-protector-strong" } */ -+ -+#include<string.h> -+#include<stdlib.h> -+ -+extern int g0; -+extern int* pg0; -+int -+goo (int *); -+int -+hoo (int); -+ -+/* Function frame address escaped function call. */ -+int -+foo1 () -+{ -+ int i; -+ return goo (&i); -+} -+ -+struct ArrayStruct -+{ -+ int a; -+ int array[10]; -+}; -+ -+struct AA -+{ -+ int b; -+ struct ArrayStruct as; -+}; -+ -+/* Function frame contains array. */ -+int -+foo2 () -+{ -+ struct AA aa; -+ int i; -+ for (i = 0; i < 10; ++i) -+ { -+ aa.as.array[i] = i * (i-1) + i / 2; -+ } -+ return aa.as.array[5]; -+} -+ -+/* Address computation based on a function frame address. */ -+int -+foo3 () -+{ -+ int a; -+ int *p; -+ p = &a + 5; -+ return goo (p); -+} -+ -+/* Address cast based on a function frame address. */ -+int -+foo4 () -+{ -+ int a; -+ return goo (g0 << 2 ? (int *)(3 * (long)(void *)(&a)) : 0); -+} -+ -+/* Address cast based on a local array. */ -+int -+foo5 () -+{ -+ short array[10]; -+ return goo ((int *)(array + 5)); -+} -+ -+struct BB -+{ -+ int one; -+ int two; -+ int three; -+}; -+ -+/* Address computaton based on a function frame address.*/ -+int -+foo6 () -+{ -+ struct BB bb; -+ return goo (&bb.one + sizeof(int)); -+} -+ -+/* Function frame address escaped via global variable. */ -+int -+foo7 () -+{ -+ int a; -+ pg0 = &a; -+ goo (pg0); -+ return *pg0; -+} -+ -+/* Check that this covers -fstack-protector. */ -+int -+foo8 () -+{ -+ char base[100]; -+ memcpy ((void *)base, (const void *)pg0, 105); -+ return (int)(base[32]); -+} -+ -+/* Check that this covers -fstack-protector. */ -+int -+foo9 () -+{ -+ char* p = alloca (100); -+ return goo ((int *)(p + 50)); -+} -+ -+int -+global2 (struct BB* pbb); -+ -+/* Address taken on struct. */ -+int -+foo10 () -+{ -+ struct BB bb; -+ int i; -+ bb.one = global2 (&bb); -+ for (i = 0; i < 10; ++i) -+ { -+ bb.two = bb.one + bb.two; -+ bb.three = bb.one + bb.two + bb.three; -+ } -+ return bb.three; -+} -+ -+/* { dg-final { scan-assembler-times "stack_chk_fail" 10 } } */ |