This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[testsuite, lto] Allow target selector for dg-extra-ld-options (PR testsuite/45851)
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Diego Novillo <dnovillo at google dot com>, Dave Korn <dave dot korn dot cygwin at gmail dot com>
- Date: Mon, 11 Oct 2010 18:56:54 +0200
- Subject: [testsuite, lto] Allow target selector for dg-extra-ld-options (PR testsuite/45851)
Dave reported that my patch to add -pthread to gcc.dg/lto/20090210 broke
the test on cygwin since dg-extra-ld-options doesn't take a target
selector. Well, it does now: tested with runtest with and without
--target i386-pc-solaris2.8 on i386-pc-solaris2.11 to make sure that
-pthread is only added in the first case.
One might consider adding it to dg-suppress-ld-options for reasons of
symmetry, but unless it has real uses, this could be delayed just as
well.
Dave, could you please test this on cygwin to make sure it fixes the
bug?
Ok for mainline if that passes?
Thanks.
Rainer
2010-10-09 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
gcc/testsuite:
PR testsuite/45851
* lib/lto.exp (lto-get-options-main): Support optional target
selector for dg-extra-ld-options.
gcc:
PR testsuite/45851
* doc/sourcebuild.texi (LTO Testing, dg-extra-ld-options):
Document optional target selector.
diff -r a2813a6bf404 gcc/doc/sourcebuild.texi
--- a/gcc/doc/sourcebuild.texi Sat Oct 09 17:29:59 2010 +0200
+++ b/gcc/doc/sourcebuild.texi Sat Oct 09 19:02:44 2010 +0200
@@ -2300,7 +2300,7 @@
to override @var{LTO_OPTIONS}. Each test will be compiled and run with
each of these sets of options.
-@item @{ dg-extra-ld-options @var{options} @}
+@item @{ dg-extra-ld-options @var{options} [@{ target @var{selector} @}]@}
This directive adds @var{options} to the linker options used.
@item @{ dg-suppress-ld-options @var{options} @}
diff -r a2813a6bf404 gcc/testsuite/lib/lto.exp
--- a/gcc/testsuite/lib/lto.exp Sat Oct 09 17:29:59 2010 +0200
+++ b/gcc/testsuite/lib/lto.exp Sat Oct 09 19:02:44 2010 +0200
@@ -277,8 +277,17 @@
warning "lto.exp does not support dg-lto-do $dgdo"
}
} elseif { ![string compare "dg-extra-ld-options" $cmd] } {
- set dg-extra-ld-options [lindex $op 2]
- verbose "dg-extra-ld-options for main is ${dg-extra-ld-options}"
+ if { [llength $op] > 4 } {
+ error "[lindex $op 0]: too many arguments"
+ } else {
+ if { [llength $op] == 3
+ || ([llength $op] > 3
+ && [dg-process-target [lindex $op 3]] == "S") } {
+ set dg-extra-ld-options [lindex $op 2]
+ verbose \
+ "dg-extra-ld-options for main is ${dg-extra-ld-options}"
+ }
+ }
} elseif { ![string compare "dg-suppress-ld-options" $cmd] } {
set dg-suppress-ld-options [lindex $op 2]
verbose \
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University