[committed, PATCH] Download source only on remote host

H.J. Lu hongjiu.lu@intel.com
Fri Apr 29 13:56:00 GMT 2016


There is no need to download source if we aren't on remote host.
Otherwise, each ld test run on local host leaves behind a couple
test files.

	* config/default.exp (NOPIE_CFLAGS): Download source only on
	remote host.
	(NOPIE_LDFLAGS): Likewise.
	* testsuite/lib/ld-lib.exp (check_lto_available): Likewise.
	(check_lto_fat_available): Likewise.
	(check_lto_shared_available): Likewise.
	(check_ifunc_available): Likewise.
	(check_ifunc_attribute_available): Likewise.
---
 ld/ChangeLog                    | 11 +++++++++++
 ld/testsuite/config/default.exp |  8 ++++++--
 ld/testsuite/lib/ld-lib.exp     | 20 +++++++++++++++-----
 3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index c4ded92..aecf581 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,14 @@
+2016-04-29  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* config/default.exp (NOPIE_CFLAGS): Download source only on
+	remote host.
+	(NOPIE_LDFLAGS): Likewise.
+	* testsuite/lib/ld-lib.exp (check_lto_available): Likewise.
+	(check_lto_fat_available): Likewise.
+	(check_lto_shared_available): Likewise.
+	(check_ifunc_available): Likewise.
+	(check_ifunc_attribute_available): Likewise.
+
 2016-04-27  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* testsuite/ld-elf/compressed1b.d: Only run for Linux/GNU targets.
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
index 2c41ff2..8ccad11 100644
--- a/ld/testsuite/config/default.exp
+++ b/ld/testsuite/config/default.exp
@@ -302,7 +302,9 @@ if { ![info exists PLT_CFLAGS] } then {
 	set f [open $src "w"]
 	puts $f ""
 	close $f
-	remote_download host $src
+	if [is_remote host] {
+	    set src [remote_download host $src]
+	}
 	set plt_available [run_host_cmd_yesno "$CC" "$flags -c -fplt $src -o $output"]
 	remote_file host delete $src
 	remote_file host delete $output
@@ -338,7 +340,9 @@ if { ![info exists NOPIE_CFLAGS] || ![info exists NOPIE_LDFLAGS] } then {
 	set f [open $src "w"]
 	puts $f "int main (void) { return 0; }"
 	close $f
-	remote_download host $src
+	if [is_remote host] {
+	    set src [remote_download host $src]
+	}
 	set nopie_available [run_host_cmd_yesno "$CC" "$flags -fno-PIE -no-pie $src -o $output"]
 	remote_file host delete $src
 	remote_file host delete $output
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 88afc5a..9333f52 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1819,7 +1819,9 @@ proc check_lto_available { } {
 	set f [open $src "w"]
 	puts $f "int main() { return 0; }"
 	close $f
-	remote_download host $src
+	if [is_remote host] {
+	    set src [remote_download host $src]
+	}
 	set lto_available_saved [run_host_cmd_yesno "$CC" "$flags -flto -fuse-linker-plugin $src -o $output"]
 	remote_file host delete $src
 	remote_file host delete $output
@@ -1860,7 +1862,9 @@ proc check_lto_fat_available { } {
 	set f [open $src "w"]
 	puts $f "int main() { return 0; }"
 	close $f
-	remote_download host $src
+	if [is_remote host] {
+	    set src [remote_download host $src]
+	}
 	set lto_fat_available_saved [run_host_cmd_yesno "$CC" "$flags -flto -ffat-lto-objects -fuse-linker-plugin $src -o $output"]
 	remote_file host delete $src
 	remote_file host delete $output
@@ -1901,7 +1905,9 @@ proc check_lto_shared_available { } {
 	set f [open $src "w"]
 	puts $f ""
 	close $f
-	remote_download host $src
+	if [is_remote host] {
+	    set src [remote_download host $src]
+	}
 	set lto_shared_available_saved [run_host_cmd_yesno "$CC" "$flags -shared -fPIC -flto -fuse-linker-plugin $src -o $output"]
 	remote_file host delete $src
 	remote_file host delete $output
@@ -1971,7 +1977,9 @@ proc check_ifunc_available { } {
 	puts $f "void *foo (void) { return library_func1; }"
 	puts $f "__asm__(\".type library_func2, %gnu_indirect_function\");"
 	close $f
-	remote_download host $src
+	if [is_remote host] {
+	    set src [remote_download host $src]
+	}
 	set ifunc_available_saved [run_host_cmd_yesno "$CC" "$flags $src -o $output"]
 	if { $ifunc_available_saved == 1 } {
 	  set ifunc_available_saved [run_host_cmd_yesno "$output" ""]
@@ -2016,7 +2024,9 @@ proc check_ifunc_attribute_available { } {
 	puts $f "static int library_func1 (void) {return 2; }"
 	puts $f "void *foo (void) { return library_func1; }"
 	close $f
-	remote_download host $src
+	if [is_remote host] {
+	    set src [remote_download host $src]
+	}
 	set ifunc_attribute_available_saved [run_host_cmd_yesno "$CC" "$flags $src -o $output"]
 	if { $ifunc_attribute_available_saved == 1 } {
 	  set ifunc_attribute_available_saved [run_host_cmd_yesno "$output" ""]
-- 
2.5.5



More information about the Binutils mailing list