]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
LoongArch: Set the default ABI of loongarch*-elf targets to double-float
authorLulu Cai <cailulu@loongson.cn>
Thu, 11 Dec 2025 07:40:58 +0000 (15:40 +0800)
committercailulu <cailulu@loongson.cn>
Sat, 13 Dec 2025 02:17:35 +0000 (10:17 +0800)
The ABI setting for the elf target was ommitted in commit "db614f37cab".
Set the default ABI for elf to double-float.

In addition, test case failures caused by the loongarch*-elf linker not
supporting relevant options have also been skipped.

gas/

        * config/tc-loongarch.c (loongarch_after_parse_args): Set
  default ABI to double-float for other targets.

ld/

        * testsuite/ld-loongarch-elf/la32.d: Skip tests when not
  supported.
        * testsuite/ld-loongarch-elf/ld-loongarch-elf.exp: Likewise.
        * testsuite/ld-loongarch-elf/relax.exp: Likewise.

gas/config/tc-loongarch.c
ld/testsuite/ld-loongarch-elf/la32.d
ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
ld/testsuite/ld-loongarch-elf/relax.exp

index e049427956c7b6caf7f37961b3ac177ccf78f3f1..beb41fc904a7bff9450399a616e29bfe2969adb3 100644 (file)
@@ -314,7 +314,8 @@ loongarch_after_parse_args ()
       else if (strcmp (TARGET_OS, "linux-gnu") == 0)
        LARCH_opts.ase_abi = EF_LOONGARCH_ABI_DOUBLE_FLOAT;
       else
-       as_fatal (_("unsupport TARGET_OS %s"), TARGET_OS);
+       /* To support lonngarch*-elf targets.  */
+       LARCH_opts.ase_abi = EF_LOONGARCH_ABI_DOUBLE_FLOAT;
     }
 
   /* Set eflags ABI version to v1 (ELF object file ABI 2.0).  */
index 9f66b7bba8f71f528adc89857f259a07eb6a22f9..7d4e0e75fbeaeaad3006e558d7c60c5ee59a6832 100644 (file)
@@ -1,6 +1,7 @@
 #as -mabi=ilp32d:
 #ld: -z norelro --hash-style=both -e0
 #objdump: -dr
+#skip: loongarch*-elf
 
 .*:[    ]+file format .*
 
index 7b0b066190c8a161be5f9acdeca9f8210f0b5c38..5c4bf3275eb3038d2a090116737bacbf88b81a0b 100644 (file)
@@ -164,18 +164,20 @@ if [istarget "loongarch64-*-*"] {
   # Using DESC and IE to access the same tls symbol but with
   # -mno-relax requires allocating GOT entries for both DESC and IE,
   # not just IE
-  run_ld_link_tests [list \
-      [list \
-         "desc and ie do not type transition" \
-         "-pie -e0 --hash-style=both" "" \
-         "-mno-relax" \
-         {desc-ie-norelax.s} \
-         {{objdump {-d} desc-ie-norelax.dd} \
-          {readelf {-rW} desc-ie-norelax.rd} \
-          {objdump {-sj.got} desc-ie-norelax.sd}} \
-         "desc-ie-norelax" \
-      ] \
-  ] \
+  if [check_pie_support] {
+    run_ld_link_tests [list \
+       [list \
+           "desc and ie do not type transition" \
+           "-pie -e0 --hash-style=both" "" \
+           "-mno-relax" \
+           {desc-ie-norelax.s} \
+           {{objdump {-d} desc-ie-norelax.dd} \
+           {readelf {-rW} desc-ie-norelax.rd} \
+           {objdump {-sj.got} desc-ie-norelax.sd}} \
+           "desc-ie-norelax" \
+       ] \
+    ] \
+  }
 
   run_ld_link_tests \
       [list \
index 49e6b23b6067405c187ca7c665d8f952c79a8b73..976ba8df0455a5d19c0c6b8204cfeb537072b3ec 100644 (file)
@@ -51,66 +51,72 @@ if [istarget loongarch64-*-*] {
     run_dump_test "relax-align-ignore-start"
     run_partial_linking_align_test
 
-    run_ld_link_tests \
-      [list \
+    if [check_shared_lib_support] {
+      run_ld_link_tests \
        [list \
-       "loongarch relax call36 .so build" \
-       "-shared" "" \
-       "" \
-       {relax-call36-so.s} \
-       {} \
-       "relax-call36.so" \
-       ] \
-      ]
+         [list \
+         "loongarch relax call36 .so build" \
+         "-shared" "" \
+         "" \
+         {relax-call36-so.s} \
+         {} \
+         "relax-call36.so" \
+         ] \
+       ]
 
-    if [file exist "tmpdir/relax-call36.so"] {
-      set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax-call36.so"]
-      if { [ regexp "pcaddu18i" $objdump_output] } {
-       fail "loongarch relax call36 so"
-      } {
-       pass "loongarch relax call36 so"
+      if [file exist "tmpdir/relax-call36.so"] {
+       set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax-call36.so"]
+       if { [ regexp "pcaddu18i" $objdump_output] } {
+         fail "loongarch relax call36 so"
+       } {
+         pass "loongarch relax call36 so"
+       }
       }
     }
 
-    run_ld_link_tests \
-      [list \
+    if [check_pie_support] {
+      run_ld_link_tests \
        [list \
-       "loongarch relax call36 dyn exe build" \
-       "-pie -e 0" "" \
-       "" \
-       {relax-call36-exe.s} \
-       {} \
-       "relax-call36-d.exe" \
-       ] \
-      ]
+         [list \
+         "loongarch relax call36 dyn exe build" \
+         "-pie -e 0" "" \
+         "" \
+         {relax-call36-exe.s} \
+         {} \
+         "relax-call36-d.exe" \
+         ] \
+       ]
 
-    if [file exist "tmpdir/relax-call36-d.exe"] {
-      set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax-call36-d.exe"]
-      if { [ regexp "pcaddu18i" $objdump_output] } {
-       fail "loongarch relax call36 dyn exe"
-      } {
-       pass "loongarch relax call36 dyn exe"
+      if [file exist "tmpdir/relax-call36-d.exe"] {
+       set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax-call36-d.exe"]
+       if { [ regexp "pcaddu18i" $objdump_output] } {
+         fail "loongarch relax call36 dyn exe"
+       } {
+         pass "loongarch relax call36 dyn exe"
+       }
       }
     }
 
-    run_ld_link_tests \
-      [list \
+    if [check_pie_support] {
+      run_ld_link_tests \
        [list \
-       "loongarch relax call36 dyn-pie exe build" \
-       "-pie -e 0" "" \
-       "" \
-       {relax-call36-exe.s} \
-       {} \
-       "relax-call36-dp.exe" \
-       ] \
-      ]
+         [list \
+         "loongarch relax call36 dyn-pie exe build" \
+         "-pie -e 0" "" \
+         "" \
+         {relax-call36-exe.s} \
+         {} \
+         "relax-call36-dp.exe" \
+         ] \
+       ]
 
-    if [file exist "tmpdir/relax-call36-dp.exe"] {
-      set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax-call36-dp.exe"]
-      if { [ regexp "pcaddu18i" $objdump_output] } {
-       fail "loongarch relax call36 dyn-pie exe"
-      } {
-       pass "loongarch relax call36 dyn-pie exe"
+      if [file exist "tmpdir/relax-call36-dp.exe"] {
+       set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax-call36-dp.exe"]
+       if { [ regexp "pcaddu18i" $objdump_output] } {
+         fail "loongarch relax call36 dyn-pie exe"
+       } {
+         pass "loongarch relax call36 dyn-pie exe"
+       }
       }
     }
 
@@ -135,24 +141,26 @@ if [istarget loongarch64-*-*] {
       }
     }
 
-    run_ld_link_tests \
-      [list \
+    if [check_pie_support] {
+      run_ld_link_tests \
        [list \
-       "loongarch relax call36 static-pie exe build" \
-       "-static -pie --no-dynamic-linker -e 0" "" \
-       "" \
-       {relax-call36-exe.s} \
-       {} \
-       "relax-call36-sp.exe" \
-       ] \
-      ]
+         [list \
+         "loongarch relax call36 static-pie exe build" \
+         "-static -pie --no-dynamic-linker -e 0" "" \
+         "" \
+         {relax-call36-exe.s} \
+         {} \
+         "relax-call36-sp.exe" \
+         ] \
+       ]
 
-    if [file exist "tmpdir/relax-call36-sp.exe"] {
-      set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax-call36-sp.exe"]
-      if { [ regexp "pcaddu18i" $objdump_output] } {
-       fail "loongarch relax call36 static-pie exe"
-      } {
-       pass "loongarch relax call36 static-pie exe"
+      if [file exist "tmpdir/relax-call36-sp.exe"] {
+       set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax-call36-sp.exe"]
+       if { [ regexp "pcaddu18i" $objdump_output] } {
+         fail "loongarch relax call36 static-pie exe"
+       } {
+         pass "loongarch relax call36 static-pie exe"
+       }
       }
     }