diff mbox

[testsuite,lto] Allow target selector for dg-extra-ld-options (PR testsuite/45851)

Message ID ydd7hho3bxl.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Oct. 11, 2010, 4:56 p.m. UTC
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.

Comments

Dave Korn Oct. 11, 2010, 5:24 p.m. UTC | #1
On 11/10/2010 17:56, Rainer Orth wrote:
> 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?

  Certainly will, thanks for the fix.  Just kicked off a bootstrap; will have
test results late tonight (GMT+0100).

    cheers,
      DaveK
Dave Korn Oct. 12, 2010, 1:47 a.m. UTC | #2
On 11/10/2010 17:56, Rainer Orth wrote:

> Dave, could you please test this on cygwin to make sure it fixes the
> bug?

  Works perfectly, TYVM :)

    cheers,
      DaveK
Richard Biener Oct. 12, 2010, 10:13 a.m. UTC | #3
On Mon, Oct 11, 2010 at 6:56 PM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> 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.

It would be nice to add it there too, for symmetry.

> Dave, could you please test this on cygwin to make sure it fixes the
> bug?
>
> Ok for mainline if that passes?

Ok.

Thanks,
Richard.

> 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
>
Rainer Orth Oct. 12, 2010, 12:09 p.m. UTC | #4
Richard Guenther <richard.guenther@gmail.com> writes:

>> 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.
>
> It would be nice to add it there too, for symmetry.

Will do as a followup.

>> Dave, could you please test this on cygwin to make sure it fixes the
>> bug?
>>
>> Ok for mainline if that passes?
>
> Ok.

Thanks, installed.

	Rainer
diff mbox

Patch

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 \