Message ID | yddhb8lwuih.fsf@manam.CeBiTec.Uni-Bielefeld.DE |
---|---|
State | New |
Headers | show |
Hi, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: > 2010-12-30 Uros Bizjak <ubizjak@gmail.com> > Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> > > * gcc.dg/torture/tls/run-gd.c: New test. > * gcc.dg/torture/tls/run-ie.c: New test. > * gcc.dg/torture/tls/run-ld.c: New test. > * gcc.dg/torture/tls/run-le.c: New test. > * lib/target-supports.exp (check_effective_target_tls_runtime): > Build testcase with TLS options. gcc.dg/torture/tls/run-gd.c fails on SH because SH assumes -fpic for global and local dynamic tls models. Although a line /* { dg-options "-fpic" { target sh*-*-* } } */ added to run-gd.c and run-ld.c tests looks enough for SH, I guess that target fpic instead of target sh*-*-* is more reasonable because GD and LD tls models are usually for shared objects. I see similar failures on S390 testresults and it seems that also S390 requires -fpic for GD and LD. Give me your thoughts? Regards, kaz
Kaz Kojima <kkojima@rr.iij4u.or.jp> writes: > gcc.dg/torture/tls/run-gd.c fails on SH because SH assumes > -fpic for global and local dynamic tls models. Although a line > > /* { dg-options "-fpic" { target sh*-*-* } } */ > > added to run-gd.c and run-ld.c tests looks enough for SH, > I guess that target fpic instead of target sh*-*-* is more > reasonable because GD and LD tls models are usually for shared > objects. I don't think so: on all my targets (Solaris/SPARC and /x86, IRIX and Tru64 UNIX), the test works without -fpic, so this seems to be quite target specific. > I see similar failures on S390 testresults and it seems that > also S390 requires -fpic for GD and LD. > Give me your thoughts? Given that this seems to be target-specific, unless we can identify a common feature of these targets, I'd rather see us xfail or skip the tests on a per-target basis. In addition, I've got a patch in the works that cycles the gcc.dg/torture/tls tests through -fpic/-fPIC and -fpie/-fPIE if available. This way, the testcases will be exercised on sh*-*-*, too. Rainer
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: > Given that this seems to be target-specific, unless we can identify a > common feature of these targets, I'd rather see us xfail or skip the > tests on a per-target basis. > > In addition, I've got a patch in the works that cycles the > gcc.dg/torture/tls tests through -fpic/-fPIC and -fpie/-fPIE if > available. This way, the testcases will be exercised on sh*-*-*, too. Sounds good. I'll add a line like /* { dg-skip-if "" { sh*-*-* } { "*" } { "-fpic" "-fPIC" "-fpie" "-fPIE" } } */ to run-[gl]d.c when your patch is installed. Thank you for your suggestion. Regards, kaz
On Sun, 29 May 2011, Kaz Kojima wrote: > Hi, > > Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: > > 2010-12-30 Uros Bizjak <ubizjak@gmail.com> > > Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> > > > > * gcc.dg/torture/tls/run-gd.c: New test. > > * gcc.dg/torture/tls/run-ie.c: New test. > > * gcc.dg/torture/tls/run-ld.c: New test. > > * gcc.dg/torture/tls/run-le.c: New test. > > * lib/target-supports.exp (check_effective_target_tls_runtime): > > Build testcase with TLS options. > > gcc.dg/torture/tls/run-gd.c fails on SH because SH assumes > -fpic for global and local dynamic tls models. Although a line That sounds like an SH target bug to me.
"Joseph S. Myers" <joseph@codesourcery.com> wrote: >> gcc.dg/torture/tls/run-gd.c fails on SH because SH assumes >> -fpic for global and local dynamic tls models. Although a line > > That sounds like an SH target bug to me. Ok, I'd like to fix the SH backend so that those tests pass without -fpic/-fpie. Regards, kaz
different issues affecting the different models, I've split the testcase into one per access model so one can easier see what's broken. Tested with the appropriate runtest invocations in the whole range of Solaris configurations, as well as Tru64 UNIX: as, ld gas, ld gas, gld alpha-dec-osf5.1b PASS i386-pc-solaris2.8 PASS gd, ld FAIL PASS i386-pc-solaris2.9 PASS gd, ld FAIL PASS i386-pc-solaris2.10 gd, ld FAIL gd, ld FAIL PASS i386-pc-solaris2.11 PASS PASS PASS sparc-pc-solaris2.8 PASS PASS PASS sparc-pc-solaris2.9 PASS PASS PASS sparc-pc-solaris2.10 PASS PASS PASS sparc-pc-solaris2.11 PASS PASS PASS The Solaris 8 and 9 as, ld configurations are actually emutls, as is Tru64 UNIX, so we won't see failures on such targets. I do have a patch for the gd and ld failures on Solaris/x86. Those models weren't excercised anywhere in the testsuite before. The failures occur since the Solaris ABI requires slightly different code sequences here, and the patch accomodates this. In the very latest version of Solaris 11, the linker maintainers have added support for the GNU code sequences, too, so all is fine there. While testing the patch, the Solaris 8 and 9 gas, ld and gas, gld configurations were UNSUPPORTED initially, since the tls_runtime test itself failed: ld.so.1: tls_runtime4775.exe: fatal: tls_runtime4775.exe: object requires TLS, but TLS failed to initialize Adding the necessary TLS options fixes this and provides the results above. I'll install the patch in a day unless someone sees any problems. Rainer 2010-12-30 Uros Bizjak <ubizjak@gmail.com> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * gcc.dg/torture/tls/run-gd.c: New test. * gcc.dg/torture/tls/run-ie.c: New test. * gcc.dg/torture/tls/run-ld.c: New test. * gcc.dg/torture/tls/run-le.c: New test. * lib/target-supports.exp (check_effective_target_tls_runtime): Build testcase with TLS options. diff --git a/gcc/testsuite/gcc.dg/torture/tls/run-gd.c b/gcc/testsuite/gcc.dg/torture/tls/run-gd.c new file mode 100644 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/tls/run-gd.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-require-effective-target tls_runtime } */ +/* { dg-add-options tls } */ + +extern void abort (void); + +__thread int tls_gd __attribute__((tls_model("global-dynamic"))) = 0; + +int get_gd (void) +{ + return tls_gd; +} + +int *get_gdp (void) +{ + return &tls_gd; +} + +int main (void) +{ + int val; + + val = get_gd (); + if (val != 0) + abort (); + + val = *get_gdp (); + if (val != 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/tls/run-ie.c b/gcc/testsuite/gcc.dg/torture/tls/run-ie.c new file mode 100644 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/tls/run-ie.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-require-effective-target tls_runtime } */ +/* { dg-add-options tls } */ + +extern void abort (void); + +__thread int tls_ie __attribute__((tls_model("initial-exec"))) = 4; + +int get_ie (void) +{ + return tls_ie; +} + +int *get_iep (void) +{ + return &tls_ie; +} + +int main (void) +{ + int val; + + val = get_ie (); + if (val != 4) + abort (); + + val = *get_iep (); + if (val != 4) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/tls/run-ld.c b/gcc/testsuite/gcc.dg/torture/tls/run-ld.c new file mode 100644 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/tls/run-ld.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-require-effective-target tls_runtime } */ +/* { dg-add-options tls } */ + +extern void abort (void); + +__thread int tls_ld __attribute__((tls_model("local-dynamic"))) = 1; +__thread int tls_ld2 __attribute__((tls_model("local-dynamic"))) = 2; + +int get_ld (void) +{ + return tls_ld + tls_ld2; +} + +int *get_ldp (void) +{ + return &tls_ld; +} + +int main (void) +{ + int val; + + val = get_ld (); + if (val != 1 + 2) + abort (); + + val = *get_ldp (); + if (val != 1) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/tls/run-le.c b/gcc/testsuite/gcc.dg/torture/tls/run-le.c new file mode 100644 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/tls/run-le.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-require-effective-target tls_runtime } */ +/* { dg-add-options tls } */ + +extern void abort (void); + +__thread int tls_le __attribute__((tls_model("local-exec"))) = 3; + +int get_le (void) +{ + return tls_le; +} + +int *get_lep (void) +{ + return &tls_le; +} + +int main (void) +{ + int val; + + val = get_le (); + if (val != 3) + abort (); + + val = *get_lep (); + if (val != 3) + abort (); + + return 0; +}