[lto] Pass -plugin to collect2

Janis Johnson janis187@us.ibm.com
Thu Dec 4 18:33:00 GMT 2008


On Thu, 2008-12-04 at 10:26 -0500, Diego Novillo wrote:
> We'd have to detect gold somehow.  Janis, is there a standard way
> of determining what linker we are using when running the
> testsuite?

Not yet, but the support is very close.  Something like this would
work; I used GNU ld as an example because I could try that.

Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	(revision 142408)
+++ gcc/testsuite/lib/target-supports.exp	(working copy)
@@ -119,6 +119,25 @@
     }]
 }
 
+# Like check_compile, but delete the output file and return true if the
+# compiler printed messages that match the pattern.
+proc check_compiler_messages_nocache { pattern args } {
+    set result [eval check_compile $args]
+    set lines [lindex $result 0]
+    set output [lindex $result 1]
+    remote_file build delete $output
+    return [regexp "$pattern" $lines]
+}
+
+# Like check_compiler_messages_nocache, but cache the result.
+# PROP is the property we're checking, and doubles as a prefix for
+# temporary filenames.
+proc check_compiler_messages { pattern prop args } {
+    return [check_cached_effective_target $prop {
+	eval [list check_compiler_messages_nocache $pattern $prop] $args
+    }]
+}
+
 # Like check_compile, but return true if the compiler printed no
 # messages and if the contents of the output file satisfy PATTERN.
 # If PATTERN has the form "!REGEXP", the contents satisfy it if they
@@ -2656,3 +2675,9 @@
 	}
     } "-lm" ]
 }
+
+proc check_effective_target_gnu_ld { } {
+    return [check_compiler_messages "GNU ld" gnu_ld executable {
+	int main () { return 0; }
+    } "-Wl,--version" ]
+}





More information about the Gcc-patches mailing list