This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

[PATCH][ld/testsuite] treate -specs as both cflags & ldflags


a couple of ld-plugin tests for LTO failed on linking stage on aarch64 bare-metal test.

these testcases need to link against rdimon to pass linking, while currently we control these ld flags by using
spec file.

the problem is -specs= only specified on cflags, while spec files actually contain options affect
linker's behavior, so specs options should be treated as both cflags & ldflags.

the solution in this patch is, if gcc driver is used as link tool, then we also append cflags to the command line so
that specs options will not be missed.

no regression on x86-64 ld test.
no regression on aarch64 bare-metal/linux test.
all ld-plugin/lto fails on bare-metal gone away.

ok for trunk?

ld/testsuite/

  * lib/ld-lib.exp (run_ld_link_exec_tests): Append board_cflags if gcc driver used
  as link tool.
  (run_cc_link_exec_tests): Likewise.
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 7d2df22..99a003e 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1276,6 +1276,13 @@ proc run_ld_link_exec_tests { targets_to_xfail ldtests } {
     global CXXFLAGS
     global errcnt
     global exec_output
+    global board_cflags
+
+    if [board_info [target_info name] exists cflags] {
+        set board_cflags " [board_info [target_info name] cflags]"
+    } else {
+	set board_cflags ""
+    }
 
     foreach testitem $ldtests {
 	foreach target $targets_to_xfail {
@@ -1335,7 +1342,7 @@ proc run_ld_link_exec_tests { targets_to_xfail ldtests } {
 	    # compile only
 	    pass $testname
 	    continue;
-	} elseif ![$link_proc $link_cmd $binfile "-L$srcdir/$subdir $ld_options $objfiles"] {
+	} elseif ![$link_proc $link_cmd $binfile "$board_cflags -L$srcdir/$subdir $ld_options $objfiles"] {
 	    set failed 1
 	}
 
@@ -1410,6 +1417,13 @@ proc run_cc_link_tests { ldtests } {
     global CXXFLAGS
     global ar
     global exec_output
+    global board_cflags
+
+    if [board_info [target_info name] exists cflags] {
+        set board_cflags " [board_info [target_info name] cflags]"
+    } else {
+	set board_cflags ""
+    }
 
     foreach testitem $ldtests {
 	set testname [lindex $testitem 0]
@@ -1466,7 +1480,7 @@ proc run_cc_link_tests { ldtests } {
 		set failed 1
 	    }
 	} else {
-	    if { ![ld_simple_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles"] } {
+	    if { ![ld_simple_link $cc_cmd $binfile "$board_cflags -L$srcdir/$subdir $ldflags $objfiles"] } {
 		set failed 1
 	    }
 

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