aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/config
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-07-27 03:42:39 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-07-27 05:12:02 -0700
commite10461aebd2c9165c168583e70e7901e962ed1bb (patch)
tree7c17a17e508129fef48d6d54359016dd77628ebd /ld/testsuite/config
parent32f573bcb3aaa1c9defcad79dbb5851fcc02ae2d (diff)
downloadgdb-e10461aebd2c9165c168583e70e7901e962ed1bb.zip
gdb-e10461aebd2c9165c168583e70e7901e962ed1bb.tar.gz
gdb-e10461aebd2c9165c168583e70e7901e962ed1bb.tar.bz2
Set PLT_CFLAGS to "-fplt" if supported
GCC 6 supports -fno-plt. But some linker tests expect PLT. This patch defines PLT_CFLAGS to "-fplt" if target compiler supports it. * config/default.exp (PLT_CFLAGS): New.
Diffstat (limited to 'ld/testsuite/config')
-rw-r--r--ld/testsuite/config/default.exp35
1 files changed, 35 insertions, 0 deletions
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
index e25189b..5acc963 100644
--- a/ld/testsuite/config/default.exp
+++ b/ld/testsuite/config/default.exp
@@ -278,3 +278,38 @@ if ![info exists LD] then {
if ![info exists LDFLAGS] then {
set LDFLAGS {}
}
+
+# Set PLT_CFLAGS to "-fplt" if target compiler supports it.
+
+if { ![info exists PLT_CFLAGS] } then {
+ if { [which $CC] != 0 } {
+ # Check if gcc supports -fplt
+ 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]"
+ }
+
+ set basename "tmpdir/plt[pid]"
+ set src ${basename}.c
+ set output ${basename}.o
+ set f [open $src "w"]
+ puts $f ""
+ close $f
+ 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
+ file delete $src
+
+ if { $plt_available == 1 } then {
+ set PLT_CFLAGS "-fplt"
+ } else {
+ set PLT_CFLAGS ""
+ }
+ } else {
+ set PLT_CFLAGS ""
+ }
+}