LoongArch: Set the default ABI of loongarch*-elf targets to double-float
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.
diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
index e049427..beb41fc 100644
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -314,7 +314,8 @@
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). */
diff --git a/ld/testsuite/ld-loongarch-elf/la32.d b/ld/testsuite/ld-loongarch-elf/la32.d
index 9f66b7b..7d4e0e7 100644
--- a/ld/testsuite/ld-loongarch-elf/la32.d
+++ b/ld/testsuite/ld-loongarch-elf/la32.d
@@ -1,6 +1,7 @@
#as -mabi=ilp32d:
#ld: -z norelro --hash-style=both -e0
#objdump: -dr
+#skip: loongarch*-elf
.*:[ ]+file format .*
diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
index 7b0b066..5c4bf32 100644
--- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
+++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
@@ -164,18 +164,20 @@
# 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 \
diff --git a/ld/testsuite/ld-loongarch-elf/relax.exp b/ld/testsuite/ld-loongarch-elf/relax.exp
index 49e6b23..976ba8d 100644
--- a/ld/testsuite/ld-loongarch-elf/relax.exp
+++ b/ld/testsuite/ld-loongarch-elf/relax.exp
@@ -51,66 +51,72 @@
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 @@
}
}
- 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"
+ }
}
}