Hi Marcus, On 14 March 2014 19:42, Marcus Shawcroft <marcus.shawcr...@gmail.com> wrote: >>> >>> Do we need a new effective target test, why is the existing >>> "fstack_protector" not appropriate? >> >> "stack_protector" does a run time test. It failed in cross compilation >> environment and these are compile only tests. > > This works fine in my cross environment, how does yours fail? > > >> Also I thought richard suggested me to add a new option for this. >> ref: http://gcc.gnu.org/ml/gcc-patches/2013-11/msg03358.html > > I read that comment to mean use an effective target test instead of > matching triples. I don't see that re-using an existing effective > target test contradicts that suggestion. > > Looking through the test suite I see that there are: > > 6 tests that use dg-do compile with dg-require-effective-target > fstack_protector > > 4 tests that use dg-do run with dg-require-effective-target fstack_protector > > 2 tests that use dg-do run {target native} dg-require-effective-target > fstack_protector > > and finally the 2 tests we are discussing that use dg-compile with a > triple test. > > so there are already tests in the testsuite that use dg-do compile > with the existing effective target test. > > I see no immediately obvious reason why the two tests that require > target native require the native constraint... but I guess that is a > different issue. >
I used the existing dg-require-effective-target check, "stack_protector" and added it in a separate line. ChangeLog. 2014-03-19 Venkataramanan Kumar <venkataramanan.ku...@linaro.org> * g++.dg/fstack-protector-strong.C: Add effetive target check for stack protection. * gcc.dg/fstack-protector-strong.c: Likewise. These two tests are passing now for aarch64-none-linux-gnu target under QEMU. Let me know if I can upstream these two patches. regards, Venkat.
Index: gcc/testsuite/g++.dg/fstack-protector-strong.C =================================================================== --- gcc/testsuite/g++.dg/fstack-protector-strong.C (revision 208609) +++ gcc/testsuite/g++.dg/fstack-protector-strong.C (working copy) @@ -1,7 +1,8 @@ /* Test that stack protection is done on chosen functions. */ -/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-do compile } */ /* { dg-options "-O2 -fstack-protector-strong" } */ +/* { dg-require-effective-target fstack_protector } */ class A { Index: gcc/testsuite/gcc.dg/fstack-protector-strong.c =================================================================== --- gcc/testsuite/gcc.dg/fstack-protector-strong.c (revision 208609) +++ gcc/testsuite/gcc.dg/fstack-protector-strong.c (working copy) @@ -1,7 +1,8 @@ /* Test that stack protection is done on chosen functions. */ -/* { dg-do compile { target i?86-*-* x86_64-*-* rs6000-*-* s390x-*-* } } */ +/* { dg-do compile } */ /* { dg-options "-O2 -fstack-protector-strong" } */ +/* { dg-require-effective-target fstack_protector } */ #include<string.h>