diff options
author | Lulu Cai <cailulu@loongson.cn> | 2025-08-16 11:48:32 +0800 |
---|---|---|
committer | cailulu <cailulu@loongson.cn> | 2025-08-22 11:34:00 +0800 |
commit | 99ee75c1cd0d43b37d89b045d8984f68763af323 (patch) | |
tree | 6aa69eac7023a9cb48e2fbf4da70deda382d8d47 | |
parent | 64c7560c6a37f848974eec5422fbbbf3fb265aa2 (diff) | |
download | gdb-99ee75c1cd0d43b37d89b045d8984f68763af323.zip gdb-99ee75c1cd0d43b37d89b045d8984f68763af323.tar.gz gdb-99ee75c1cd0d43b37d89b045d8984f68763af323.tar.bz2 |
LoongArch: Improve the reliability of test cases
Fix PR ld/31101
In some distributions, GCC enables --as-needed by default, which
may prevent linking to necessary dynamic libraries and cause test
failures. When tests require the host GCC, use the --no-as-needed
option and place the necessary dynamic libraries after the object
files. This prevents test failures and improves the test case
reliability.
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/pic.exp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/ld/testsuite/ld-loongarch-elf/pic.exp b/ld/testsuite/ld-loongarch-elf/pic.exp index e449a33..510c3fd 100644 --- a/ld/testsuite/ld-loongarch-elf/pic.exp +++ b/ld/testsuite/ld-loongarch-elf/pic.exp @@ -115,31 +115,33 @@ run_ld_link_tests $link_tests set link_tests_libc [list \ [list \ "$testname readelf -s/-r nopic-global-so" \ - "-L./tmpdir -lnopic-global -L/usr/lib -lc" "" \ + "-Wl,--no-as-needed" "" \ {nopic-global.s} \ {{readelf {-s} nopic-global-so.sd} \ {readelf {-r} nopic-global-so.rd}} \ "nopic-global-so" \ + "" "-L./tmpdir -lnopic-global" \ ] \ [list \ "$testname readelf -s/-x nopic-weak-global-so" \ - "-L./tmpdir -lnopic-global -L/usr/lib -lc" "" \ + "-Wl,--no-as-needed" "" \ {nopic-weak-global.s} \ {{readelf {-s} nopic-weak-global-so.sd} \ {readelf {-r} nopic-weak-global-so.rd}} \ "nopic-weak-global-so" \ + "" "-L./tmpdir -lnopic-global" \ ] \ ] # 0:name -# 1:ld/ar leading options, placed before object files -# 2:ld/ar trailing options, placed after object files -# 3:assembler options -# 4:filenames of assembler files -# 5:list of actions, options and expected outputs. -# 6:name of output file -# 7:compiler flags (optional) +# 1:leading ld or ar options +# 2:compile options +# 3:filenames of source files +# 4:action and options. +# 5:name of output file +# 6:language (optional) +# 7:trailing ld options (optional), placed after object files run_cc_link_tests $link_tests_libc @@ -170,10 +172,11 @@ set link_exec_tests [list \ ] \ [list \ "$testname" \ - "-L./tmpdir -lnopic-global -lc -Wl,-rpath=./tmpdir -no-pie" "" \ + "-Wl,--no-as-needed" "" \ { nopic-global.s } \ "nopic-global-so" \ - "nopic-global.out" \ + "nopic-global.out" "" "" "" \ + "-L./tmpdir -lnopic-global -lc -Wl,-rpath=./tmpdir -no-pie" \ ] \ [list \ "$testname" \ @@ -184,10 +187,11 @@ set link_exec_tests [list \ ] \ [list \ "$testname" \ - "-L./tmpdir -lnopic-global -lc -Wl,-rpath=./tmpdir -no-pie" "" \ + "-Wl,--no-as-needed" "" \ { nopic-weak-global.s } \ "nopic-weak-global-so" \ - "nopic-weak-global.out" \ + "nopic-weak-global.out" "" "" "" \ + "-L./tmpdir -lnopic-global -lc -Wl,-rpath=./tmpdir -no-pie" \ ] \ ] |