Hi, This patch adds bind_pic_locally to a certain tests that depend on the availability of functions, declared in them. Those tests fail on Android (or on any other pic target); As for gcc/testsuite/g++.dg/fstack-protector-strong.[cC] - this is a related problem. I've added target nonpic, cause __stack_chk_fail (that is scanned in them) is not emitted in position independent case.
Patch is regtested on x86_64-unknown-linux-gnu. Is it OK? 2014-11-12 Alexander Ivchenko <alexander.ivche...@intel.com> * c-c++-common/tm/safe-3.c: Add bind_pic_locally. * g++.dg/ipa/devirt-15.C: Ditto. * g++.dg/ipa/devirt-7.C: Ditto. * g++.dg/ipa/pr60600.C: Ditto. * g++.dg/opt/vt2.C: Ditto. * g++.dg/opt/vt4.C: Ditto. * g++.dg/pr48484.C: Ditto. * g++.dg/tm/pr47746.C: Ditto. * g++.dg/tree-ssa/pr57380.C: Ditto. * gcc.dg/ipa/inline-4.c: Ditto. * gcc.dg/ipa/inlinehint-1.c: Ditto. * gcc.dg/ipa/inlinehint-2.c: Ditto. * gcc.dg/ipa/inlinehint-3.c: Ditto. * gcc.dg/pr47276.c: Ditto. * gcc.dg/pure-2.c: Ditto. * gcc.dg/tm/nested-2.c: Ditto. * gcc.dg/tree-ssa/alias-29.c: Ditto. * gcc.target/i386/3dnow-1.c: Ditto. * gcc.target/i386/3dnow-2.c: Ditto. * gcc.target/i386/3dnowA-1.c: Ditto. * gcc.target/i386/3dnowA-2.c: Ditto. * gcc.target/i386/avx-1.c: Ditto. * gcc.target/i386/avx-2.c: Ditto. * gcc.target/i386/memcpy-1.c: Ditto. * gcc.target/i386/mmx-1.c: Ditto. * gcc.target/i386/mmx-2.c: Ditto. * gcc.target/i386/sse-14.c: Ditto. * gcc.target/i386/sse-22.c: Ditto. * gcc.target/i386/sse-22a.c: Ditto. * gcc.target/i386/sse-23.c: Ditto. * gcc.target/i386/sse-24.c: Ditto. * gcc.target/i386/vect-double-1.c: Ditto. * g++.dg/fstack-protector-strong.C: Add target nonpic. * gcc.dg/fstack-protector-strong.c: Ditto. diff --git a/gcc/testsuite/c-c++-common/tm/safe-3.c b/gcc/testsuite/c-c++-common/tm/safe-3.c index 8a883db..becbd2f 100644 --- a/gcc/testsuite/c-c++-common/tm/safe-3.c +++ b/gcc/testsuite/c-c++-common/tm/safe-3.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-fgnu-tm" } */ +/* { dg-add-options bind_pic_locally } */ void f_extern (void); void f_first (void); diff --git a/gcc/testsuite/g++.dg/fstack-protector-strong.C b/gcc/testsuite/g++.dg/fstack-protector-strong.C index 5a820ed..ae6d2fd 100644 --- a/gcc/testsuite/g++.dg/fstack-protector-strong.C +++ b/gcc/testsuite/g++.dg/fstack-protector-strong.C @@ -3,6 +3,11 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-O2 -fstack-protector-strong" } */ +/* This test checks the presence of __stack_chk_fail function in assembler. + * Compiler generates _stack_chk_fail_local (wrapper) calls instead for PIC. + */ +/* { dg-require-effective-target nonpic } */ + class A { public: diff --git a/gcc/testsuite/g++.dg/ipa/devirt-15.C b/gcc/testsuite/g++.dg/ipa/devirt-15.C index 9245646..fd83894 100644 --- a/gcc/testsuite/g++.dg/ipa/devirt-15.C +++ b/gcc/testsuite/g++.dg/ipa/devirt-15.C @@ -2,6 +2,8 @@ A is noreturn. */ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-ipa-devirt-details -fdump-tree-optimized" } */ +/* { dg-add-options bind_pic_locally } */ + class A { public: virtual int foo(void) diff --git a/gcc/testsuite/g++.dg/ipa/devirt-7.C b/gcc/testsuite/g++.dg/ipa/devirt-7.C index 1c59122..30df64a 100644 --- a/gcc/testsuite/g++.dg/ipa/devirt-7.C +++ b/gcc/testsuite/g++.dg/ipa/devirt-7.C @@ -2,6 +2,7 @@ comes from a method that has been early-inlined into a descendant. */ /* { dg-do run } */ /* { dg-options "-O3 -fdump-ipa-cp" } */ +/* { dg-add-options bind_pic_locally } */ extern "C" void abort (void); diff --git a/gcc/testsuite/g++.dg/ipa/pr60600.C b/gcc/testsuite/g++.dg/ipa/pr60600.C index 0753931..8f6cd7a 100644 --- a/gcc/testsuite/g++.dg/ipa/pr60600.C +++ b/gcc/testsuite/g++.dg/ipa/pr60600.C @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fdump-ipa-cp" } */ +/* { dg-add-options bind_pic_locally } */ struct data { data(int); diff --git a/gcc/testsuite/g++.dg/opt/vt2.C b/gcc/testsuite/g++.dg/opt/vt2.C index a77db38..780f587 100644 --- a/gcc/testsuite/g++.dg/opt/vt2.C +++ b/gcc/testsuite/g++.dg/opt/vt2.C @@ -1,5 +1,6 @@ // PR c++/34949 // { dg-options "-O3" } +// { dg-add-options bind_pic_locally } // { dg-final { scan-assembler-not "mov\[^\n\]*_ZTV" { target i?86-*-* x86_64-*-* } } } class Foo diff --git a/gcc/testsuite/g++.dg/opt/vt4.C b/gcc/testsuite/g++.dg/opt/vt4.C index c8d04cf..98378da 100644 --- a/gcc/testsuite/g++.dg/opt/vt4.C +++ b/gcc/testsuite/g++.dg/opt/vt4.C @@ -1,6 +1,7 @@ // PR c++/50243 // { dg-do compile } // { dg-options "-O" } +// { dg-add-options bind_pic_locally } // { dg-final { scan-assembler-not "_ZTV.A" } } void foo (); diff --git a/gcc/testsuite/g++.dg/pr48484.C b/gcc/testsuite/g++.dg/pr48484.C index 3f17f39..1380c45 100644 --- a/gcc/testsuite/g++.dg/pr48484.C +++ b/gcc/testsuite/g++.dg/pr48484.C @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O -finline-functions -finline-small-functions -Wuninitialized" } */ - +/* { dg-add-options bind_pic_locally } */ struct SQObjectPtr { diff --git a/gcc/testsuite/g++.dg/tm/pr47746.C b/gcc/testsuite/g++.dg/tm/pr47746.C index 7cd9e10..6108297 100644 --- a/gcc/testsuite/g++.dg/tm/pr47746.C +++ b/gcc/testsuite/g++.dg/tm/pr47746.C @@ -1,5 +1,6 @@ // { dg-do compile } // { dg-options "-fgnu-tm" } +/* { dg-add-options bind_pic_locally } */ class InputStream { diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr57380.C b/gcc/testsuite/g++.dg/tree-ssa/pr57380.C index 0a2b2ad..b370292 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr57380.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr57380.C @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-phiopt1" } */ +/* { dg-add-options bind_pic_locally } */ struct my_array { int data[4]; diff --git a/gcc/testsuite/gcc.dg/fstack-protector-strong.c b/gcc/testsuite/gcc.dg/fstack-protector-strong.c index da33abb..8e9d891 100644 --- a/gcc/testsuite/gcc.dg/fstack-protector-strong.c +++ b/gcc/testsuite/gcc.dg/fstack-protector-strong.c @@ -3,6 +3,11 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* rs6000-*-* s390x-*-* } } */ /* { dg-options "-O2 -fstack-protector-strong" } */ +/* This test checks the presence of __stack_chk_fail function in assembler. + * Compiler generates _stack_chk_fail_local (wrapper) calls instead for PIC. + */ +/* { dg-require-effective-target nonpic } */ + #include<string.h> extern int g0; diff --git a/gcc/testsuite/gcc.dg/ipa/inline-4.c b/gcc/testsuite/gcc.dg/ipa/inline-4.c index af5c302..6df541a 100644 --- a/gcc/testsuite/gcc.dg/ipa/inline-4.c +++ b/gcc/testsuite/gcc.dg/ipa/inline-4.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-Os -c -fdump-ipa-inline -fno-early-inlining -fno-partial-inlining -fno-ipa-cp" } */ +/* { dg-add-options bind_pic_locally } */ void work_hard (void); diff --git a/gcc/testsuite/gcc.dg/ipa/inlinehint-1.c b/gcc/testsuite/gcc.dg/ipa/inlinehint-1.c index 1cc5bdd..c1688f1 100644 --- a/gcc/testsuite/gcc.dg/ipa/inlinehint-1.c +++ b/gcc/testsuite/gcc.dg/ipa/inlinehint-1.c @@ -1,4 +1,6 @@ /* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining -fno-ipa-cp" } */ +/* { dg-add-options bind_pic_locally } */ + void test2 (int); int test (int a) diff --git a/gcc/testsuite/gcc.dg/ipa/inlinehint-2.c b/gcc/testsuite/gcc.dg/ipa/inlinehint-2.c index 1579c24..d1119a5 100644 --- a/gcc/testsuite/gcc.dg/ipa/inlinehint-2.c +++ b/gcc/testsuite/gcc.dg/ipa/inlinehint-2.c @@ -1,4 +1,6 @@ /* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining -fno-ipa-cp" } */ +/* { dg-add-options bind_pic_locally } */ + int t(int s, void **p) { diff --git a/gcc/testsuite/gcc.dg/ipa/inlinehint-3.c b/gcc/testsuite/gcc.dg/ipa/inlinehint-3.c index f8d61a0..6a424ff 100644 --- a/gcc/testsuite/gcc.dg/ipa/inlinehint-3.c +++ b/gcc/testsuite/gcc.dg/ipa/inlinehint-3.c @@ -1,4 +1,6 @@ /* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining -fno-ipa-cp" } */ +/* { dg-add-options bind_pic_locally } */ + void abort (void); int scc_entry (int); int sum; diff --git a/gcc/testsuite/gcc.dg/pr47276.c b/gcc/testsuite/gcc.dg/pr47276.c index 9276b1a..fb0c125 100644 --- a/gcc/testsuite/gcc.dg/pr47276.c +++ b/gcc/testsuite/gcc.dg/pr47276.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-require-alias "" } */ /* { dg-require-visibility "" } */ +/* { dg-add-options bind_pic_locally } */ #define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) #define ASMNAME2(prefix, cname) STRING (prefix) cname diff --git a/gcc/testsuite/gcc.dg/pure-2.c b/gcc/testsuite/gcc.dg/pure-2.c index 8c2ba56..b74d9a8 100644 --- a/gcc/testsuite/gcc.dg/pure-2.c +++ b/gcc/testsuite/gcc.dg/pure-2.c @@ -1,5 +1,5 @@ -/* { dg-do compile } */ /* { dg-options "-O2 -Wsuggest-attribute=pure" } */ +/* { dg-add-options bind_pic_locally } */ extern int extern_const(int a) __attribute__ ((pure)); extern int v; diff --git a/gcc/testsuite/gcc.dg/tm/nested-2.c b/gcc/testsuite/gcc.dg/tm/nested-2.c index 205ca8d..2ea3b93 100644 --- a/gcc/testsuite/gcc.dg/tm/nested-2.c +++ b/gcc/testsuite/gcc.dg/tm/nested-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-fgnu-tm" } */ +/* { dg-add-options bind_pic_locally } */ void foobar(void) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-29.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-29.c index 4d57ca8..b23bdea 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/alias-29.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-29.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O -fdump-tree-optimized" } */ +/* { dg-add-options bind_pic_locally } */ union X { int i; diff --git a/gcc/testsuite/gcc.target/i386/3dnow-1.c b/gcc/testsuite/gcc.target/i386/3dnow-1.c index 953dc2a..c0800cf 100644 --- a/gcc/testsuite/gcc.target/i386/3dnow-1.c +++ b/gcc/testsuite/gcc.target/i386/3dnow-1.c @@ -1,6 +1,7 @@ /* { dg-do assemble } */ /* { dg-require-effective-target 3dnow } */ /* { dg-options "-O2 -Werror-implicit-function-declaration -m3dnow" } */ +/* { dg-add-options bind_pic_locally } */ /* Test that the intrinsics compile with optimization. All of them are defined as inline functions in mmintrin.h that reference the proper diff --git a/gcc/testsuite/gcc.target/i386/3dnow-2.c b/gcc/testsuite/gcc.target/i386/3dnow-2.c index 84b8540..a89cb0b 100644 --- a/gcc/testsuite/gcc.target/i386/3dnow-2.c +++ b/gcc/testsuite/gcc.target/i386/3dnow-2.c @@ -1,6 +1,7 @@ /* { dg-do assemble } */ /* { dg-require-effective-target 3dnow } */ /* { dg-options "-O0 -Werror-implicit-function-declaration -m3dnow" } */ +/* { dg-add-options bind_pic_locally } */ /* Test that the intrinsics compile without optimization. All of them are defined as inline functions in mmintrin.h that reference the proper diff --git a/gcc/testsuite/gcc.target/i386/3dnowA-1.c b/gcc/testsuite/gcc.target/i386/3dnowA-1.c index e502dc9..74e852f 100644 --- a/gcc/testsuite/gcc.target/i386/3dnowA-1.c +++ b/gcc/testsuite/gcc.target/i386/3dnowA-1.c @@ -1,6 +1,7 @@ /* { dg-do assemble } */ /* { dg-require-effective-target 3dnow } */ /* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -m3dnow" } */ +/* { dg-add-options bind_pic_locally } */ /* Test that the intrinsics compile with optimization. All of them are defined as inline functions in mmintrin.h that reference the proper diff --git a/gcc/testsuite/gcc.target/i386/3dnowA-2.c b/gcc/testsuite/gcc.target/i386/3dnowA-2.c index 8475094..c1f2daa 100644 --- a/gcc/testsuite/gcc.target/i386/3dnowA-2.c +++ b/gcc/testsuite/gcc.target/i386/3dnowA-2.c @@ -1,6 +1,7 @@ /* { dg-do assemble } */ /* { dg-require-effective-target 3dnow } */ /* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -m3dnow" } */ +/* { dg-add-options bind_pic_locally } */ /* Test that the intrinsics compile without optimization. All of them are defined as inline functions in mmintrin.h that reference the proper diff --git a/gcc/testsuite/gcc.target/i386/avx-1.c b/gcc/testsuite/gcc.target/i386/avx-1.c index 6b048e0..0418d07 100644 --- a/gcc/testsuite/gcc.target/i386/avx-1.c +++ b/gcc/testsuite/gcc.target/i386/avx-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -m3dnow -mavx -mavx2 -maes -mpclmul" } */ +/* { dg-add-options bind_pic_locally } */ #include <mm_malloc.h> diff --git a/gcc/testsuite/gcc.target/i386/avx-2.c b/gcc/testsuite/gcc.target/i386/avx-2.c index 17bc64e..0061d9c 100644 --- a/gcc/testsuite/gcc.target/i386/avx-2.c +++ b/gcc/testsuite/gcc.target/i386/avx-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -m3dnow -mavx -mavx2 -msse4a -maes -mpclmul" } */ +/* { dg-add-options bind_pic_locally } */ #include <mm_malloc.h> diff --git a/gcc/testsuite/gcc.target/i386/memcpy-1.c b/gcc/testsuite/gcc.target/i386/memcpy-1.c index 2a7595e..725c864 100644 --- a/gcc/testsuite/gcc.target/i386/memcpy-1.c +++ b/gcc/testsuite/gcc.target/i386/memcpy-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target ia32 } */ /* { dg-options "-O2 -march=pentiumpro -minline-all-stringops -fno-common" } */ +/* { dg-add-options bind_pic_locally } */ /* { dg-final { scan-assembler "rep" } } */ /* { dg-final { scan-assembler "movs" } } */ /* { dg-final { scan-assembler-not "test" } } */ diff --git a/gcc/testsuite/gcc.target/i386/mmx-1.c b/gcc/testsuite/gcc.target/i386/mmx-1.c index e304aca..7078c22 100644 --- a/gcc/testsuite/gcc.target/i386/mmx-1.c +++ b/gcc/testsuite/gcc.target/i386/mmx-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-do compile { target { nonpic } } } */ /* { dg-options "-O2 -Werror-implicit-function-declaration -mmmx" } */ +/* { dg-add-options bind_pic_locally } */ /* Test that the intrinsics compile with optimization. All of them are defined as inline functions in mmintrin.h that reference the proper diff --git a/gcc/testsuite/gcc.target/i386/mmx-2.c b/gcc/testsuite/gcc.target/i386/mmx-2.c index d15ceb1..2bb5488 100644 --- a/gcc/testsuite/gcc.target/i386/mmx-2.c +++ b/gcc/testsuite/gcc.target/i386/mmx-2.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O0 -Werror-implicit-function-declaration -mmmx" } */ +/* { dg-add-options bind_pic_locally } */ /* Test that the intrinsics compile without optimization. All of them are defined as inline functions in mmintrin.h that reference the proper builtin functions. Defining away "extern" and "__inline" results in diff --git a/gcc/testsuite/gcc.target/i386/sse-14.c b/gcc/testsuite/gcc.target/i386/sse-14.c index cc3b29c..a2a4f73 100644 --- a/gcc/testsuite/gcc.target/i386/sse-14.c +++ b/gcc/testsuite/gcc.target/i386/sse-14.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl" } */ +/* { dg-add-options bind_pic_locally } */ #include <mm_malloc.h> diff --git a/gcc/testsuite/gcc.target/i386/sse-22.c b/gcc/testsuite/gcc.target/i386/sse-22.c index c1aea92..1d1ed7b 100644 --- a/gcc/testsuite/gcc.target/i386/sse-22.c +++ b/gcc/testsuite/gcc.target/i386/sse-22.c @@ -1,6 +1,7 @@ /* Same as sse-14, except converted to use #pragma GCC option. */ /* { dg-do compile } */ /* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8" } */ +/* { dg-add-options bind_pic_locally } */ #include <mm_malloc.h> diff --git a/gcc/testsuite/gcc.target/i386/sse-22a.c b/gcc/testsuite/gcc.target/i386/sse-22a.c index 688908f..11b4a97 100644 --- a/gcc/testsuite/gcc.target/i386/sse-22a.c +++ b/gcc/testsuite/gcc.target/i386/sse-22a.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8" } */ +/* { dg-add-options bind_pic_locally } */ #define DIFFERENT_PRAGMAS diff --git a/gcc/testsuite/gcc.target/i386/sse-23.c b/gcc/testsuite/gcc.target/i386/sse-23.c index 06c9bed..f54f98d 100644 --- a/gcc/testsuite/gcc.target/i386/sse-23.c +++ b/gcc/testsuite/gcc.target/i386/sse-23.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8" } */ +/* { dg-add-options bind_pic_locally } */ #include <mm_malloc.h> diff --git a/gcc/testsuite/gcc.target/i386/sse-24.c b/gcc/testsuite/gcc.target/i386/sse-24.c index daeb968..768eb0d 100644 --- a/gcc/testsuite/gcc.target/i386/sse-24.c +++ b/gcc/testsuite/gcc.target/i386/sse-24.c @@ -1,5 +1,6 @@ /* PR target/44338 */ /* { dg-do compile } */ /* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -ffp-contract=off" } */ +/* { dg-add-options bind_pic_locally } */ #include "sse-23.c" diff --git a/gcc/testsuite/gcc.target/i386/vect-double-1.c b/gcc/testsuite/gcc.target/i386/vect-double-1.c index d96d639..734ee41 100644 --- a/gcc/testsuite/gcc.target/i386/vect-double-1.c +++ b/gcc/testsuite/gcc.target/i386/vect-double-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-march=*" } { "-march=core2" } } */ /* { dg-options "-O2 -ftree-vectorize -mfpmath=sse -march=core2 -fdump-tree-vect-stats" } */ +/* { dg-add-options bind_pic_locally } */ extern void abort (void); --Alexander