From: Patrick O'Neill <patrick@rivosinc.com>
To: binutils@sourceware.org, nelson.chu@sifive.com
Cc: gnu-toolchain@rivosinc.com, jim.wilson.gcc@gmail.com,
palmer@rivosinc.com, andrew@sifive.com, kito.cheng@gmail.com,
Patrick O'Neill <patrick@rivosinc.com>
Subject: [PATCH v3 1/3] RISCV: Add linker relaxation tests
Date: Fri, 27 May 2022 14:20:03 -0700 [thread overview]
Message-ID: <20220527212005.30709-2-patrick@rivosinc.com> (raw)
In-Reply-To: <20220527212005.30709-1-patrick@rivosinc.com>
Add basic tests for the behavior of relaxing function calls.
This covers behavior like relaxing a call, not relaxing a call, and
relaxing a call that is enabled by relaxing another call.
2022-05-27 Patrick O'Neill <patrick@rivosinc.com>
* ld-riscv-elf.exp: Add testcases.
* relax-call-1.d: Add new testcase.
* relax-call-1.s: Likewise.
* relax-call-2.d: Likewise.
* relax-call-2.s: Likewise.
* relax-call-3.d: Likewise.
* relax-call-3.s: Likewise.
* relax-call-4.d: Likewise.
* relax-call-4.s: Likewise.
* relax-call-5.d: Likewise.
* relax-call-5.s: Likewise.
* relax-call-6.d: Likewise.
* relax-call-6.s: Likewise.
Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
---
ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp | 6 ++++++
ld/testsuite/ld-riscv-elf/relax-call-1.d | 17 +++++++++++++++
ld/testsuite/ld-riscv-elf/relax-call-1.s | 7 ++++++
ld/testsuite/ld-riscv-elf/relax-call-2.d | 21 ++++++++++++++++++
ld/testsuite/ld-riscv-elf/relax-call-2.s | 10 +++++++++
ld/testsuite/ld-riscv-elf/relax-call-3.d | 25 ++++++++++++++++++++++
ld/testsuite/ld-riscv-elf/relax-call-3.s | 13 +++++++++++
ld/testsuite/ld-riscv-elf/relax-call-4.d | 19 ++++++++++++++++
ld/testsuite/ld-riscv-elf/relax-call-4.s | 8 +++++++
ld/testsuite/ld-riscv-elf/relax-call-5.d | 23 ++++++++++++++++++++
ld/testsuite/ld-riscv-elf/relax-call-5.s | 11 ++++++++++
ld/testsuite/ld-riscv-elf/relax-call-6.d | 22 +++++++++++++++++++
ld/testsuite/ld-riscv-elf/relax-call-6.s | 11 ++++++++++
13 files changed, 193 insertions(+)
create mode 100644 ld/testsuite/ld-riscv-elf/relax-call-1.d
create mode 100644 ld/testsuite/ld-riscv-elf/relax-call-1.s
create mode 100644 ld/testsuite/ld-riscv-elf/relax-call-2.d
create mode 100644 ld/testsuite/ld-riscv-elf/relax-call-2.s
create mode 100644 ld/testsuite/ld-riscv-elf/relax-call-3.d
create mode 100644 ld/testsuite/ld-riscv-elf/relax-call-3.s
create mode 100644 ld/testsuite/ld-riscv-elf/relax-call-4.d
create mode 100644 ld/testsuite/ld-riscv-elf/relax-call-4.s
create mode 100644 ld/testsuite/ld-riscv-elf/relax-call-5.d
create mode 100644 ld/testsuite/ld-riscv-elf/relax-call-5.s
create mode 100644 ld/testsuite/ld-riscv-elf/relax-call-6.d
create mode 100644 ld/testsuite/ld-riscv-elf/relax-call-6.s
diff --git a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
index 272424b33e3..60f7cc5f208 100644
--- a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
+++ b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
@@ -119,6 +119,12 @@ proc run_relax_twice_test {} {
}
if [istarget "riscv*-*-*"] {
+ run_dump_test "relax-call-1"
+ run_dump_test "relax-call-2"
+ run_dump_test "relax-call-3"
+ run_dump_test "relax-call-4"
+ run_dump_test "relax-call-5"
+ run_dump_test "relax-call-6"
run_dump_test "align-small-region"
run_dump_test "call-relax"
run_dump_test "pcgp-relax-01"
diff --git a/ld/testsuite/ld-riscv-elf/relax-call-1.d b/ld/testsuite/ld-riscv-elf/relax-call-1.d
new file mode 100644
index 00000000000..3e7bfb500c9
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/relax-call-1.d
@@ -0,0 +1,17 @@
+#source: relax-call-1.s
+#ld: --relax
+#objdump: -d
+
+
+.*: file format .*
+
+
+Disassembly of section \.text:
+
+.*<foo>:
+.*ret
+
+.* <_start>:
+.*jal.* <foo>
+.*ret
+#pass
\ No newline at end of file
diff --git a/ld/testsuite/ld-riscv-elf/relax-call-1.s b/ld/testsuite/ld-riscv-elf/relax-call-1.s
new file mode 100644
index 00000000000..7b81e28f99f
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/relax-call-1.s
@@ -0,0 +1,7 @@
+ .text
+foo:
+ jr ra
+ .globl _start
+_start:
+ call foo
+ jr ra
diff --git a/ld/testsuite/ld-riscv-elf/relax-call-2.d b/ld/testsuite/ld-riscv-elf/relax-call-2.d
new file mode 100644
index 00000000000..7481bea8c1e
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/relax-call-2.d
@@ -0,0 +1,21 @@
+#source: relax-call-2.s
+#ld: --relax
+#objdump: -d
+
+
+.*: file format .*
+
+
+Disassembly of section \.text:
+
+.*<foo>:
+.*ret
+
+.*<bar>:
+.*ret
+
+.* <_start>:
+.*jal.* <foo>
+.*jal.* <bar>
+.*ret
+#pass
\ No newline at end of file
diff --git a/ld/testsuite/ld-riscv-elf/relax-call-2.s b/ld/testsuite/ld-riscv-elf/relax-call-2.s
new file mode 100644
index 00000000000..7f5844a6789
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/relax-call-2.s
@@ -0,0 +1,10 @@
+ .text
+foo:
+ jr ra
+bar:
+ jr ra
+ .globl _start
+_start:
+ call foo
+ call bar
+ jr ra
diff --git a/ld/testsuite/ld-riscv-elf/relax-call-3.d b/ld/testsuite/ld-riscv-elf/relax-call-3.d
new file mode 100644
index 00000000000..5c49222e056
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/relax-call-3.d
@@ -0,0 +1,25 @@
+#source: relax-call-3.s
+#ld: --relax
+#objdump: -d
+
+
+.*: file format .*
+
+
+Disassembly of section \.text:
+
+.*<foo>:
+.*ret
+
+.*<bar>:
+.*ret
+
+.*<baz>:
+.*ret
+
+.* <_start>:
+.*jal.* <foo>
+.*jal.* <bar>
+.*jal.* <baz>
+.*ret
+#pass
\ No newline at end of file
diff --git a/ld/testsuite/ld-riscv-elf/relax-call-3.s b/ld/testsuite/ld-riscv-elf/relax-call-3.s
new file mode 100644
index 00000000000..66e7c02ca19
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/relax-call-3.s
@@ -0,0 +1,13 @@
+ .text
+foo:
+ jr ra
+bar:
+ jr ra
+baz:
+ jr ra
+ .globl _start
+_start:
+ call foo
+ call bar
+ call baz
+ jr ra
diff --git a/ld/testsuite/ld-riscv-elf/relax-call-4.d b/ld/testsuite/ld-riscv-elf/relax-call-4.d
new file mode 100644
index 00000000000..09e939ca9b4
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/relax-call-4.d
@@ -0,0 +1,19 @@
+#source: relax-call-4.s
+#ld: --relax
+#objdump: -d
+
+
+.*: file format .*
+
+
+Disassembly of section \.text:
+
+.*<foo>:
+.*ret
+.*\.\.\.
+
+.* <_start>:
+.*auipc.*
+.*jalr.* <foo>
+.*ret
+#pass
\ No newline at end of file
diff --git a/ld/testsuite/ld-riscv-elf/relax-call-4.s b/ld/testsuite/ld-riscv-elf/relax-call-4.s
new file mode 100644
index 00000000000..44eed0bc128
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/relax-call-4.s
@@ -0,0 +1,8 @@
+ .text
+foo:
+ jr ra
+ .zero 1048570
+ .globl _start
+_start:
+ call foo
+ jr ra
diff --git a/ld/testsuite/ld-riscv-elf/relax-call-5.d b/ld/testsuite/ld-riscv-elf/relax-call-5.d
new file mode 100644
index 00000000000..d9f44e5f8a2
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/relax-call-5.d
@@ -0,0 +1,23 @@
+#source: relax-call-5.s
+#ld: --relax
+#objdump: -d
+
+
+.*: file format .*
+
+
+Disassembly of section \.text:
+
+.*<foo>:
+.*ret
+.*\.\.\.
+
+.*<bar>:
+.*ret
+
+.* <_start>:
+.*auipc.*
+.*jalr.* <foo>
+.*jal.* <bar>
+.*ret
+#pass
\ No newline at end of file
diff --git a/ld/testsuite/ld-riscv-elf/relax-call-5.s b/ld/testsuite/ld-riscv-elf/relax-call-5.s
new file mode 100644
index 00000000000..5605fb14e78
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/relax-call-5.s
@@ -0,0 +1,11 @@
+ .text
+foo:
+ jr ra
+ .zero 1048566
+bar:
+ jr ra
+ .globl _start
+_start:
+ call foo
+ call bar
+ jr ra
diff --git a/ld/testsuite/ld-riscv-elf/relax-call-6.d b/ld/testsuite/ld-riscv-elf/relax-call-6.d
new file mode 100644
index 00000000000..c385ccb5511
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/relax-call-6.d
@@ -0,0 +1,22 @@
+#source: relax-call-6.s
+#ld: --relax
+#objdump: -d
+
+
+.*: file format .*
+
+
+Disassembly of section \.text:
+
+.*<foo>:
+.*ret
+.*\.\.\.
+
+.*<bar>:
+.*ret
+
+.* <_start>:
+.*jal.* <bar>
+.*jal.* <foo>
+.*ret
+#pass
\ No newline at end of file
diff --git a/ld/testsuite/ld-riscv-elf/relax-call-6.s b/ld/testsuite/ld-riscv-elf/relax-call-6.s
new file mode 100644
index 00000000000..6df73e108f4
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/relax-call-6.s
@@ -0,0 +1,11 @@
+ .text
+foo:
+ jr ra
+ .zero 1048560
+bar:
+ jr ra
+ .globl _start
+_start:
+ call bar
+ call foo
+ jr ra
--
2.25.1
next prev parent reply other threads:[~2022-05-27 21:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 16:25 [PATCH 0/4] RISCV: Improve linker time complexity Patrick O'Neill
2022-04-12 16:25 ` [PATCH 1/4] RISCV: Add linker relaxation tests Patrick O'Neill
2022-04-12 16:25 ` [PATCH 2/4] RISCV: Arrange DELETE pass after .align pass Patrick O'Neill
2022-04-12 16:26 ` [PATCH 3/4] RISCV: Implement piecewise deletion Patrick O'Neill
2022-04-12 16:26 ` [PATCH 4/4] RISCV: Improve runtime of align directives Patrick O'Neill
2022-04-13 0:58 ` [PATCH 0/4] RISCV: Improve linker time complexity Kito Cheng
2022-04-13 2:23 ` Palmer Dabbelt
2022-04-13 5:12 ` Alan Modra
2022-04-13 18:11 ` Palmer Dabbelt
2022-04-25 17:26 ` Patrick O'Neill
2022-05-02 13:50 ` [PATCH v2 0/5] " Patrick O'Neill
2022-05-02 13:50 ` [PATCH v2 1/5] RISCV: Add linker relaxation tests Patrick O'Neill
2022-05-02 13:50 ` [PATCH v2 2/5] RISCV: Arrange DELETE pass after .align pass Patrick O'Neill
2022-05-02 13:50 ` [PATCH v2 3/5] RISCV: Implement piecewise deletion Patrick O'Neill
2022-05-20 10:48 ` Nelson Chu
2022-05-20 17:36 ` Patrick O'Neill
2022-05-02 13:50 ` [PATCH v2 4/5] RISCV: Improve runtime of align directives Patrick O'Neill
2022-05-02 13:50 ` [PATCH v2 5/5] RISCV: Add --defer-deletion flag Patrick O'Neill
2022-05-27 21:20 ` [PATCH v3 0/3] RISCV: Improve linker time complexity Patrick O'Neill
2022-05-27 21:20 ` Patrick O'Neill [this message]
2022-05-27 21:20 ` [PATCH v3 2/3] RISCV: Implement piecewise deletion Patrick O'Neill
2022-05-27 21:20 ` [PATCH v3 3/3] RISCV: Add --defer-deletion flag Patrick O'Neill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220527212005.30709-2-patrick@rivosinc.com \
--to=patrick@rivosinc.com \
--cc=andrew@sifive.com \
--cc=binutils@sourceware.org \
--cc=gnu-toolchain@rivosinc.com \
--cc=jim.wilson.gcc@gmail.com \
--cc=kito.cheng@gmail.com \
--cc=nelson.chu@sifive.com \
--cc=palmer@rivosinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).