# MA 02110-1301, USA.
#
+proc riscv_choose_ilp32_emul {} {
+ if { [istarget "riscvbe-*"] \
+ || [istarget "riscv32be-*"] \
+ || [istarget "riscv64be-*"] } {
+ return "elf32briscv"
+ }
+ return "elf32lriscv"
+}
+
+proc riscv_choose_lp64_emul {} {
+ if { [istarget "riscvbe-*"] \
+ || [istarget "riscv32be-*"] \
+ || [istarget "riscv64be-*"] } {
+ return "elf64briscv"
+ }
+ return "elf64lriscv"
+}
+
# target: rv32 or rv64.
# output: Which output you want? (exe, pie, .so)
proc run_dump_test_ifunc { name target output} {
switch -- $target {
rv32 {
set asflags "$asflags -march=rv32i -mabi=ilp32"
- set ldflags "$ldflags -melf32lriscv"
+ set ldflags "$ldflags -m[riscv_choose_ilp32_emul]"
}
rv64 {
set asflags "$asflags -march=rv64i -mabi=lp64 -defsym __64_bit__=1"
- set ldflags "$ldflags -melf64lriscv"
+ set ldflags "$ldflags -m[riscv_choose_lp64_emul]"
}
}
run_dump_test "attr-merge-priv-spec-failed-04"
run_dump_test "attr-merge-priv-spec-failed-05"
run_dump_test "attr-merge-priv-spec-failed-06"
- run_ld_link_tests {
- { "Weak reference 32" "-T weakref.ld -melf32lriscv" ""
- "-march=rv32i -mabi=ilp32" {weakref32.s}
- {{objdump -d weakref32.d}} "weakref32"}
- { "Weak reference 64" "-T weakref.ld -melf64lriscv" ""
- "-march=rv64i -mabi=lp64" {weakref64.s}
- {{objdump -d weakref64.d}} "weakref64"}
- }
+ run_ld_link_tests [list \
+ [list "Weak reference 32" "-T weakref.ld -m[riscv_choose_ilp32_emul]" "" \
+ "-march=rv32i -mabi=ilp32" {weakref32.s} \
+ {{objdump -d weakref32.d}} "weakref32"] \
+ [list "Weak reference 64" "-T weakref.ld -m[riscv_choose_lp64_emul]" "" \
+ "-march=rv64i -mabi=lp64" {weakref64.s} \
+ {{objdump -d weakref64.d}} "weakref64"]]
# The following tests require shared library support.
if ![check_shared_lib_support] {
return
}
- set abis { rv32gc ilp32 elf32lriscv rv64gc lp64 elf64lriscv }
+ set abis [list rv32gc ilp32 [riscv_choose_ilp32_emul] rv64gc lp64 [riscv_choose_lp64_emul]]
foreach { arch abi emul } $abis {
# This checks whether our linker scripts handle __global_pointer$
# correctly. It should be defined in executables and PIE, but not