public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] gas: RISC-V: Add a test for near->far branch conversion
@ 2023-01-30 21:06 Palmer Dabbelt
  2023-01-30 21:06 ` [PATCH 2/2] ld: RISC-V: Test R_RISCV_BRANCH truncation errors Palmer Dabbelt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2023-01-30 21:06 UTC (permalink / raw)
  To: binutils; +Cc: Palmer Dabbelt

This works in GAS and has for a very long time, but I couldn't find a
test case for it.  It doesn't appear to be documented anywhere, but GCC
depends on it and I'd bet a bunch of handwritten assembly does too so
it's probably too late to drop.
---
 gas/testsuite/gas/riscv/far-branch.d | 13 +++++++++++++
 gas/testsuite/gas/riscv/far-branch.s |  6 ++++++
 2 files changed, 19 insertions(+)
 create mode 100644 gas/testsuite/gas/riscv/far-branch.d
 create mode 100644 gas/testsuite/gas/riscv/far-branch.s

diff --git a/gas/testsuite/gas/riscv/far-branch.d b/gas/testsuite/gas/riscv/far-branch.d
new file mode 100644
index 00000000000..e781e3eadb5
--- /dev/null
+++ b/gas/testsuite/gas/riscv/far-branch.d
@@ -0,0 +1,13 @@
+#as: -march=rv32i
+#objdump: -d
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[^:]+:[ 	]+00b51063[ 	]+bne[ 	]+a0,a1,0 <target>
+#...
+[^:]+:[ 	]+00b50463[ 	]+beq[ 	]+a0,a1,.*
+[^:]+:[ 	]+ff9fe06f[ 	]+j[ 	]+0 <target>
diff --git a/gas/testsuite/gas/riscv/far-branch.s b/gas/testsuite/gas/riscv/far-branch.s
new file mode 100644
index 00000000000..2b369ffb538
--- /dev/null
+++ b/gas/testsuite/gas/riscv/far-branch.s
@@ -0,0 +1,6 @@
+target:
+	bne a0, a1, target
+.rep 1024
+	nop
+.endr
+	bne a0, a1, target
-- 
2.39.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-31  8:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30 21:06 [PATCH 1/2] gas: RISC-V: Add a test for near->far branch conversion Palmer Dabbelt
2023-01-30 21:06 ` [PATCH 2/2] ld: RISC-V: Test R_RISCV_BRANCH truncation errors Palmer Dabbelt
2023-01-31  3:37 ` [PATCH 1/2] gas: RISC-V: Add a test for near->far branch conversion Nelson Chu
2023-01-31  8:57 ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).