diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2018-01-27 16:04:34 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-01-27 16:04:34 -0800 |
commit | fef75122c0fe3abafb99d79a63545c1531f4107c (patch) | |
tree | f5d5ced02ce4086635d582664b0f0eb056c7de8b /ld/testsuite/config | |
parent | 8d3b78ce4563e65466202c0d29d0603877846323 (diff) | |
download | gdb-fef75122c0fe3abafb99d79a63545c1531f4107c.zip gdb-fef75122c0fe3abafb99d79a63545c1531f4107c.tar.gz gdb-fef75122c0fe3abafb99d79a63545c1531f4107c.tar.bz2 |
Add a testcase for PR ld/22751
Since dummy.o must be placed before
-Wl,--whole-archive tmpdir/pr22751.a -Wl,--no-whole-archive
to trigger the bug, this patch adds an optional trailing ld options to
run_ld_link_exec_tests.
PR ld/22751
* testsuite/config/default.exp (INT128_CFLAGS): New.
* testsuite/ld-plugin/lto.exp (INT128_CFLAGS): New.
Run ld/22751 tests.
* testsuite/ld-plugin/pr22751.c: New file.
* testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Add
ld trailing options.
Diffstat (limited to 'ld/testsuite/config')
-rw-r--r-- | ld/testsuite/config/default.exp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp index 29c020f..fe3bd32 100644 --- a/ld/testsuite/config/default.exp +++ b/ld/testsuite/config/default.exp @@ -376,3 +376,40 @@ 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 "" + } +} |