This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Patch,ld] Fix check_lto_available
- From: Vidya Praveen <vidyapraveen at arm dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: nickc at redhat dot com
- Date: Wed, 11 Dec 2013 13:57:32 +0000
- Subject: [Patch,ld] Fix check_lto_available
- Authentication-results: sourceware.org; auth=none
Hello,
This patch modifies check_lto_available of ld regression test to
1. Make use of cflags, ldflags from board description file
2. Test by building an executable rather than a shared library
- This is needed for the baremetal targets as shared library makes no sense
to the baremetal targets. lto.exp which makes use of this check also has
guard for shared library tests.
Reference:
https://sourceware.org/ml/binutils/2013-10/msg00214.html
Tested for aarch64-none-elf and arm-none-eabi, arm-none-linux-gnueabihf and
x86_64-unknown-linux-gnu.
OK for trunk?
Cheers
VP.
ld/testsuite/ChangeLog:
2013-12-11 Vidya Praveen <vidyapraveen@arm.com>
* lib/ld-lib.exp (check_lto_available): Support cflags,ldflags and
test by compiling for an executable rather than shared library.
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 67c429f..f22fa8e 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1629,6 +1641,17 @@ proc check_plugin_api_available { } {
proc check_lto_available { } {
global lto_available_saved
global CC
+
+ set flags ""
+
+ if [board_info [target_info name] exists cflags] {
+ append flags " [board_info [target_info name] cflags]"
+ }
+
+ if [board_info [target_info name] exists ldflags] {
+ append flags " [board_info [target_info name] ldflags]"
+ }
+
if {![info exists lto_available_saved]} {
# Check if gcc supports -flto -fuse-linker-plugin
if { [which $CC] == 0 } {
@@ -1637,11 +1660,11 @@ proc check_lto_available { } {
}
set basename "lto"
set src ${basename}[pid].c
- set output ${basename}[pid].so
+ set output ${basename}[pid].out
set f [open $src "w"]
- puts $f ""
+ puts $f "int main() { return 0; }"
close $f
- set status [remote_exec host $CC "-shared -B[pwd]/tmpdir/ld/ -flto -fuse-linker-plugin $src -o $output"]
+ set status [remote_exec host $CC "$flags -B[pwd]/tmpdir/ld/ -flto -fuse-linker-plugin $src -o $output"]
if { [lindex $status 0] == 0 } {
set lto_available_saved 1
} else {