]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
LoongArch: Fix ld FAIL test cases
authorLulu Cai <cailulu@loongson.cn>
Wed, 17 Jul 2024 02:54:46 +0000 (10:54 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Thu, 1 Aug 2024 02:23:37 +0000 (10:23 +0800)
To avoid differences in C library paths on different systems
use gcc instead of ld to perform the test.

Problems caused by adding options to different distributions
will not be fixed.

ld/testsuite/ld-loongarch-elf/pic.exp

index bcea5a3c153711b60b2d78c68c92ee17b6ff2f1c..64c316045d0aa559f0473991b6e3e8c7ef7b805f 100644 (file)
@@ -92,17 +92,6 @@ set link_tests [list \
       ] \
     "nopic-global" \
   ] \
-  [list \
-    "$testname readelf -s/-r nopic-global-so" \
-    "-L./tmpdir -lnopic-global -L/usr/lib -lc" "" \
-    "" \
-    {nopic-global.s} \
-      [list \
-       [list readelf -s nopic-global-so.sd] \
-       [list readelf -r nopic-global-so.rd] \
-      ] \
-    "nopic-global-so" \
-  ] \
   [list \
     "$testname readelf -s/-x nopic-weak-global" \
     "-T pic.ld" "" \
@@ -114,19 +103,35 @@ set link_tests [list \
       ] \
     "nopic-weak-global" \
   ] \
+]
+
+# Since the c library path may be different in different
+# Distributions, the test program can link to the c library
+# using the gcc instead of ld to avoid system impact.
+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" "" \
+    {nopic-global.s} \
+    {{readelf {-s} nopic-global-so.sd} \
+     {readelf {-r} nopic-global-so.rd}} \
+    "nopic-global-so" \
+  ] \
   [list \
     "$testname readelf -s/-x nopic-weak-global-so" \
     "-L./tmpdir -lnopic-global -L/usr/lib -lc" "" \
-    "" \
     {nopic-weak-global.s} \
-      [list \
-       [list readelf -s nopic-weak-global-so.sd] \
-       [list readelf -r nopic-weak-global-so.rd] \
-      ] \
+    {{readelf {-s} nopic-weak-global-so.sd} \
+     {readelf {-r} nopic-weak-global-so.rd}} \
     "nopic-weak-global-so" \
   ] \
 ]
 
+
 #  0:name
 #  1:ld/ar leading options, placed before object files
 #  2:ld/ar trailing options, placed after object files
@@ -135,7 +140,9 @@ set link_tests [list \
 #  5:list of actions, options and expected outputs.
 #  6:name of output file
 #  7:compiler flags (optional)
-run_ld_link_tests $link_tests
+run_cc_link_tests $link_tests_libc
+
+
 
 set testname "nopic link exec test"