elfedit: Add --enable-x86-feature/--disable-x86-feature
[deliverable/binutils-gdb.git] / ld / testsuite / config / default.exp
index 29c020ffa46ed77358d05c63fa8e6100e37e9a28..fbc12eabf960b4bf931b2aa910cc6db8e42de8bd 100644 (file)
@@ -243,6 +243,10 @@ if ![info exists READELFFLAGS] then {
     set READELFFLAGS {}
 }
 
+if ![info exists ELFEDIT] then {
+    set ELFEDIT [findfile $base_dir/../binutils/elfedit]
+}
+
 if ![info exists LD] then {
     set LD [findfile $base_dir/ld-new ./ld-new [transform ld]]
 }
@@ -376,3 +380,77 @@ if { ![info exists GNU2_CFLAGS] } then {
        set GNU2_CFLAGS ""
     }
 }
+
+# Set INT128_CFLAGS to "-DHAS_INT128" if target compiler supports __int128.
+
+if { ![info exists INT128_CFLAGS] } then {
+    if { [which $CC] != 0 } {
+       # Check if gcc supports __int128.
+       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/int128[pid]"
+       set src ${basename}.c
+       set output ${basename}.o
+       set f [open $src "w"]
+       puts $f "__int128 a = 42;"
+       close $f
+       if [is_remote host] {
+           set src [remote_download host $src]
+       }
+       set int128_available [run_host_cmd_yesno "$CC" "$flags -c $src -o $output"]
+       remote_file host delete $src
+       remote_file host delete $output
+       file delete $src
+
+       if { $int128_available == 1 } then {
+           set INT128_CFLAGS "-DHAS_INT128"
+       } else {
+           set INT128_CFLAGS ""
+       }
+    } else {
+       set INT128_CFLAGS ""
+    }
+}
+
+# Set STATIC_LDFLAGS to "-static" if target compiler supports it.
+
+if { ![info exists STATIC_LDFLAGS] } then {
+    if { [which $CC] != 0 } {
+       # Check if gcc supports -static.
+       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/static[pid]"
+       set src ${basename}.c
+       set output ${basename}
+       set f [open $src "w"]
+       puts $f "int main (void) { return 0; }"
+       close $f
+       if [is_remote host] {
+           set src [remote_download host $src]
+       }
+       set static_available [run_host_cmd_yesno "$CC" "-static $flags $src -o $output"]
+       remote_file host delete $src
+       remote_file host delete $output
+       file delete $src
+
+       if { $static_available == 1 } then {
+           set STATIC_LDFLAGS "-static"
+       } else {
+           set STATIC_LDFLAGS ""
+       }
+    } else {
+       set STATIC_LDFLAGS ""
+    }
+}
This page took 0.024208 seconds and 4 git commands to generate.