This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[LTO][PATCH] Add link time flags suppression to LTO testsuite


This patch adds (yet) another flags control for use by LTO test cases.  The
new flag complements dg-extra-ld-options by allowing a set of flags to be
given that are removed from the options used at link.

This feature is needed for a couple of LTO test cases involving flags that need
to be passed to cc1 on compilation but not passed to lto1 on link.


2009-02-09  Simon Baldwin  <simonb@google.com>

	* lib/lto.exp (lto-get-options-main): Add support for suppressing
	flags at the link stage with dg-suppress-ld-options.
	(lto-execute): Filter option to remove any members of
	dg-suppress-ld-options prior to lto-link-and-maybe-run.


Index: gcc/testsuite/lib/lto.exp
===================================================================
--- gcc/testsuite/lib/lto.exp	(revision 144036)
+++ gcc/testsuite/lib/lto.exp	(working copy)
@@ -152,8 +152,10 @@ proc lto-link-and-maybe-run { testname o
 proc lto-get-options-main { src } {
     global compile_type
     global dg-extra-ld-options
+    global dg-suppress-ld-options
 
     set dg-extra-ld-options ""
+    set dg-suppress-ld-options ""
 
     # dg-options sets a variable called dg-extra-tool-flags.
     set dg-extra-tool-flags ""
@@ -197,6 +199,10 @@ proc lto-get-options-main { src } {
 	} 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}"
+	} elseif { ![string compare "dg-suppress-ld-options" $cmd] } {
+	    set dg-suppress-ld-options [lindex $op 2]
+	    verbose \
+	      "dg-suppress-ld-options for main is ${dg-suppress-ld-options}"
 	} elseif { ![string compare "dg-final" $cmd] } {
 	    if { [llength $op] > 3 } {
 		error "[lindex $op 0]: too many arguments"
@@ -271,6 +277,7 @@ proc lto-execute { src1 sid } {
     global dg-do-what-default
     global compile_type
     global dg-extra-ld-options
+    global dg-suppress-ld-options
     global LTO_OPTIONS
     global dg-final-code
 
@@ -385,9 +392,20 @@ proc lto-execute { src1 sid } {
 	# Link (using the compiler under test), run, and clean up tests.
 	if { ![string compare "run" $compile_type] \
 	     || ![string compare "link" $compile_type] } {
+
+	    # Filter out any link options we were asked to suppress.
+	    set reduced {}
+	    foreach x [split $option] {
+	      if {[lsearch ${dg-suppress-ld-options} $x] == -1} {
+		lappend reduced $x
+	      }
+	    }
+	    set filtered [join $reduced " "]
+
 	    lto-link-and-maybe-run \
 		    "[lindex $obj_list 0]-[lindex $obj_list end]" \
-		    $obj_list $execname $option ${dg-extra-ld-options} $option
+		    $obj_list $execname $filtered ${dg-extra-ld-options} \
+		    $filtered
 	}
 
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]