]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
RISC-V: avoid ld crashes due to bogus use by testcases
authorJan Beulich <jbeulich@suse.com>
Fri, 12 Dec 2025 07:06:41 +0000 (08:06 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 12 Dec 2025 07:06:41 +0000 (08:06 +0100)
Specifying a little-endian emulation isn't very helpful when the target is
big-endian (and hence gas defaults to that). Surely the linker better
wouldn't crash when invoked like this, but making sure of this isn't the
purpose of any of these tests (afaict). Make assembly output match linker
options.

With this the ld testsuite completes successfully for me. binutils and gas
testsuites still have issues.

29 files changed:
ld/testsuite/ld-riscv-elf/align-small-region.d
ld/testsuite/ld-riscv-elf/code-model-medany-01.d
ld/testsuite/ld-riscv-elf/code-model-medany-02.d
ld/testsuite/ld-riscv-elf/code-model-medany-weakref-01.d
ld/testsuite/ld-riscv-elf/code-model-medany-weakref-02.d
ld/testsuite/ld-riscv-elf/code-model-medlow-01.d
ld/testsuite/ld-riscv-elf/code-model-medlow-02.d
ld/testsuite/ld-riscv-elf/code-model-medlow-weakref-01.d
ld/testsuite/ld-riscv-elf/code-model-medlow-weakref-02.d
ld/testsuite/ld-riscv-elf/code-model-relax-medany-01.d
ld/testsuite/ld-riscv-elf/code-model-relax-medany-02.d
ld/testsuite/ld-riscv-elf/code-model-relax-medany-weakref-01.d
ld/testsuite/ld-riscv-elf/code-model-relax-medany-weakref-02.d
ld/testsuite/ld-riscv-elf/code-model-relax-medlow-01-norelaxgp.d
ld/testsuite/ld-riscv-elf/code-model-relax-medlow-01.d
ld/testsuite/ld-riscv-elf/code-model-relax-medlow-02.d
ld/testsuite/ld-riscv-elf/code-model-relax-medlow-weakref-01.d
ld/testsuite/ld-riscv-elf/code-model-relax-medlow-weakref-02.d
ld/testsuite/ld-riscv-elf/pcrel-reloc-abs-nopie.d
ld/testsuite/ld-riscv-elf/pcrel-reloc-abs-pie.d
ld/testsuite/ld-riscv-elf/pcrel-reloc-rel-nopie.d
ld/testsuite/ld-riscv-elf/pcrel-reloc-rel-pie.d
ld/testsuite/ld-riscv-elf/property-combine-and-1.d
ld/testsuite/ld-riscv-elf/property-combine-and-2.d
ld/testsuite/ld-riscv-elf/property-combine-and-3.d
ld/testsuite/ld-riscv-elf/property-zicfilp-unlabeled.d
ld/testsuite/ld-riscv-elf/property-zicfiss.d
ld/testsuite/ld-riscv-elf/uleb128.d
ld/testsuite/ld-riscv-elf/zicfilp-unlabeled-plt.d

index 3799129c6651443953106c9c5dde3ec9fb3c504f..26ab1846c59c51207c919650fce2a198ab4c9988 100644 (file)
@@ -1,5 +1,5 @@
 #source: align-small-region.s
-#as: -march=rv32i
+#as: -march=rv32i -mlittle-endian
 #ld: -melf32lriscv --relax -Talign-small-region.ld --defsym=_start=0x100
 #objdump: -d
 
index 071eee8e5b43e4917d315d75f6ee7bfba3d3691e..318cceec2a616c6662c8fe26d3add27663ed8b2a 100644 (file)
@@ -1,4 +1,4 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medany__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medany__=1
 #ld: -Tcode-model-01.ld -melf64lriscv --no-relax
 #error: .*relocation truncated to fit: R_RISCV_GOT_HI20 against symbol `symbolG'
index 017a1dcfda437de3ebbf1df6b648707a0a53d4ca..235d1ea318c473082e601eeafc87325f830deb0d 100644 (file)
@@ -1,5 +1,5 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medany__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medany__=1
 #ld: -Tcode-model-02.ld -melf64lriscv --no-relax
 #objdump: -d -Mno-aliases
 
index 0fe5c451393c2561a3e85d32bee8bb7c86a1fcaa..546d5c188eb3b468ee7eaf6af33036bf3663bb77 100644 (file)
@@ -1,4 +1,4 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medany__=1 --defsym __undefweak__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medany__=1 --defsym __undefweak__=1
 #ld: -Tcode-model-01.ld -melf64lriscv --no-relax
 #error: .*relocation truncated to fit: R_RISCV_GOT_HI20 against undefined symbol `symbolW'
index 2b3aaae82a8fccad04be7456874b860649673b24..54d32e4e8008088de3c3f2ecdd0706782f6d7b95 100644 (file)
@@ -1,5 +1,5 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medany__=1 --defsym __undefweak__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medany__=1 --defsym __undefweak__=1
 #ld: -Tcode-model-02.ld -melf64lriscv --no-relax
 #objdump: -d -Mno-aliases
 
index a92389326ef6273758cb4b03d46ac542f467bf57..d9194573773f8c2679769d3c34ff78d2e596b9fd 100644 (file)
@@ -1,4 +1,4 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medlow__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medlow__=1
 #ld: -Tcode-model-01.ld -melf64lriscv --no-relax
 #error: .*relocation truncated to fit: R_RISCV_HI20 against `symbolL'
index 11688635fe62893a07d264ba72ec6edf7a25dc8d..de659ee273aeea139dfcc0a44aad7837d1c742ce 100644 (file)
@@ -1,5 +1,5 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medlow__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medlow__=1
 #ld: -Tcode-model-02.ld -melf64lriscv --no-relax
 #objdump: -d -Mno-aliases
 
index 28f8fe98b2a3897e0d8ebacdc692481c46b0332a..52e3f0de37bf6db0b3aef7709c69823cfc6c7cfa 100644 (file)
@@ -1,5 +1,5 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medlow__=1 --defsym __undefweak__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medlow__=1 --defsym __undefweak__=1
 #ld: -Tcode-model-01.ld -melf64lriscv --no-relax
 #objdump: -d -Mno-aliases
 
index 405b0fe25af66f0ea926ed60c8d659cca65087e8..758104ee91e761cc0546b06d1b5398fdffb1cf00 100644 (file)
@@ -1,5 +1,5 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medlow__=1 --defsym __undefweak__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medlow__=1 --defsym __undefweak__=1
 #ld: -Tcode-model-02.ld -melf64lriscv --no-relax
 #objdump: -d -Mno-aliases
 
index afa24eff632bc5f8404d511f13edfc2a6d7ffea4..e97457d78e0bf459380f5358ef9bdf4bbce847c2 100644 (file)
@@ -1,4 +1,4 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medany__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medany__=1
 #ld: -Tcode-model-01.ld -melf64lriscv --relax
 #error: .*relocation truncated to fit: R_RISCV_GOT_HI20 against symbol `symbolG'
index 7b5b9e99c663a552d9586cc96bec92c32d47292c..3ab235e79873b51886c24986e1a144e6db500ba7 100644 (file)
@@ -1,5 +1,5 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medany__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medany__=1
 #ld: -Tcode-model-02.ld -melf64lriscv --relax
 #objdump: -d -Mno-aliases
 
index 5b2d1eaf1db1669262a4cbdc334328b2d5fa8bca..61289a644c84f2cbc8756bc87c302200cfc3295c 100644 (file)
@@ -1,4 +1,4 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medany__=1 --defsym __undefweak__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medany__=1 --defsym __undefweak__=1
 #ld: -Tcode-model-01.ld -melf64lriscv --relax
 #error: .*relocation truncated to fit: R_RISCV_GOT_HI20 against undefined symbol `symbolW'
index 783be0c536212917deac216f0dbe2617d484ca6f..6be00f65c0faed2b27de78819f6bf3e9037562e8 100644 (file)
@@ -1,5 +1,5 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medany__=1 --defsym __undefweak__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medany__=1 --defsym __undefweak__=1
 #ld: -Tcode-model-02.ld -melf64lriscv --relax
 #objdump: -d -Mno-aliases
 
index 8e40cc5f32d5b193703a84c12d729aca2a16f0de..3389860ae9aac91deebb1ad143a5be550cd49a1e 100644 (file)
@@ -1,4 +1,4 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medlow__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medlow__=1
 #ld: -Tcode-model-01.ld -melf64lriscv --no-relax-gp --relax
 #error: .*relocation truncated to fit: R_RISCV_HI20 against `symbolL'
index eea2f7d6615f4e6d290ffa43b4b230d8be98a3ca..4f645f30c0efdde45cb6b34d3d9c2678def30d63 100644 (file)
@@ -1,5 +1,5 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medlow__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medlow__=1
 #ld: -Tcode-model-01.ld -melf64lriscv --relax
 #objdump: -d -Mno-aliases
 
index adc81f5ab2073b3968772f236a2bcb7186c76f51..d9118ad83aa42fe785c356ee4e1d30693d8b4405 100644 (file)
@@ -1,5 +1,5 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medlow__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medlow__=1
 #ld: -Tcode-model-02.ld -melf64lriscv --relax
 #objdump: -d -Mno-aliases
 
index b1f22039ee9eaa03c982046ac67c3fe5f3be42c7..d1e693ab93302631029a9648f0b1ca6895103cb6 100644 (file)
@@ -1,5 +1,5 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medlow__=1 --defsym __undefweak__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medlow__=1 --defsym __undefweak__=1
 #ld: -Tcode-model-01.ld -melf64lriscv --relax
 #objdump: -d -Mno-aliases
 
index 332046d7c5b366c360e4ede89d9c5ba9a1530c70..a0348aed78ce8d00550e892bb79731335102fec0 100644 (file)
@@ -1,5 +1,5 @@
 #source: code-model.s
-#as: -march=rv64i -mabi=lp64 --defsym __medlow__=1 --defsym __undefweak__=1
+#as: -march=rv64i -mabi=lp64 -mlittle-endian --defsym __medlow__=1 --defsym __undefweak__=1
 #ld: -Tcode-model-02.ld -melf64lriscv --relax
 #objdump: -d -Mno-aliases
 
index 54026388b7ac89e8a9fab21bc1bebf67cd380771..947c96195fb10e88dcadfdc9fc29b7fe7bec7c8f 100644 (file)
@@ -1,6 +1,6 @@
 #source: pcrel-reloc.s
 #source: pcrel-reloc-abs.s
-#as: -march=rv64i -mabi=lp64
+#as: -march=rv64i -mabi=lp64 -mlittle-endian
 #ld: -melf64lriscv --no-pie --no-relax
 #objdump: -d
 
index 7f5eaa321f7cc81f8f7ea3e3a77450d33aeb5e35..a9f7917adf8aa3c3097d3f450cb453cd0fb6434d 100644 (file)
@@ -1,5 +1,5 @@
 #source: pcrel-reloc.s
 #source: pcrel-reloc-abs.s
-#as: -march=rv64i -mabi=lp64
+#as: -march=rv64i -mabi=lp64 -mlittle-endian
 #ld: -melf64lriscv --pie --no-relax
 #error: .*relocation R_RISCV_PCREL_HI20 against absolute symbol `sym' can not be used when making a shared objec.*t
index ab2a3774cdd889682bb52bfac41c9008c4e67e53..fdf6a7c82166807a0bb22d7238aef2e28809dbaa 100644 (file)
@@ -1,6 +1,6 @@
 #source: pcrel-reloc.s
 #source: pcrel-reloc-rel.s
-#as: -march=rv64i -mabi=lp64
+#as: -march=rv64i -mabi=lp64 -mlittle-endian
 #ld: -melf64lriscv --no-pie --no-relax
 #objdump: -d
 
index aec612d4d2c56c95bcbff1c72d86c9a38efeb14b..854d6d384a0d5ffa85983add7e78dca346d33502 100644 (file)
@@ -1,6 +1,6 @@
 #source: pcrel-reloc.s
 #source: pcrel-reloc-rel.s
-#as: -march=rv64i -mabi=lp64
+#as: -march=rv64i -mabi=lp64 -mlittle-endian
 #ld: -melf64lriscv --pie --no-relax
 #objdump: -d
 
index 571620f848e6d01c0584f9c2233f8a01e968dabd..a48e93e06a8ea53afb48366f60d71e943bc87233 100644 (file)
@@ -1,6 +1,6 @@
 #name: RISC-V GNU Property (multiple inputs, combine section) - 1
 #source: property1.s
 #source: property2.s
-#as: -march=rv64g
+#as: -march=rv64g -mlittle-endian
 #ld: -shared -melf64lriscv
 #readelf: -n
index 23482af01af489ca18e1aeac6350e6602b85a576..77706edcd31dfe9636c7582ed473ba82b6fb9d9d 100644 (file)
@@ -1,7 +1,7 @@
 #name: RISC-V GNU Property (multiple inputs, combine section) - 2
 #source: property1.s
 #source: property3.s
-#as: -march=rv64g
+#as: -march=rv64g -mlittle-endian
 #ld: -shared -melf64lriscv
 #readelf: -n
 
index b57a0f763949da3f15c897dd83ab28e9abda73f9..4f0c514803477bcee54bd0a900d8b87bdae2c770 100644 (file)
@@ -1,7 +1,7 @@
 #name: RISC-V GNU Property (multiple inputs, combine section) - 3
 #source: property1.s
 #source: property4.s
-#as: -march=rv64g
+#as: -march=rv64g -mlittle-endian
 #ld: -shared -melf64lriscv
 #readelf: -n
 
index 48d60d6fca07cfeabfe7c807fbce2087ebab5428..7f5c0af48c245133e7517097fa2d50844e7795a0 100644 (file)
@@ -1,6 +1,6 @@
 #name: GNU Property (single input, CFI_LP_UNLABELED)
 #source: property-zicfilp-unlabeled.s
-#as: -march=rv64g
+#as: -march=rv64g -mlittle-endian
 #ld: -shared -melf64lriscv
 #readelf: -n
 
index 0dec1a10db0441071b22e0654d63b458049846d3..c94a8ba865a5c7bb215cbb9a636b0dcd46c53f65 100644 (file)
@@ -1,6 +1,6 @@
 #name: GNU Property (single input, CFI_SS)
 #source: property-zicfiss.s
-#as: -march=rv64g
+#as: -march=rv64g -mlittle-endian
 #ld: -shared -melf64lriscv
 #readelf: -n
 
index a921478e988be0f9d8bd1acbdcebbe16c824f847..e5826282663ef847863ccab6c8c5e459eecc5c04 100644 (file)
@@ -1,5 +1,5 @@
 #source: uleb128.s
-#as: -march=rv32ic
+#as: -march=rv32ic -mlittle-endian
 #ld: -melf32lriscv
 #objdump: -d
 
index bb888d163ded385552d7535dc1922a2766bc4922..b56d5cbe9e664c83a6a20836932ae8a64629647e 100644 (file)
@@ -2,7 +2,7 @@
 #source: zicfilp-unlabeled-plt.s
 #ld: -shared -melf64lriscv
 #objdump: -dr -j .plt
-#as: -march=rv64gc_zicfilp
+#as: -march=rv64gc_zicfilp -mlittle-endian
 
 [^:]*: *file format elf64-.*riscv