From eed62915fd5b733632af343fbf3d47c7364f8e36 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Fri, 15 Feb 2019 16:43:23 -0800 Subject: bfd: xtensa: fix callx relaxation Big section alignment requirements between source and destination of a long call can result in making call range bigger than what's reachable by the call opcode. Add biggest section alignment of sections between the call site and call destination to the call distance when making long call relaxation decision. 2019-02-20 Eric Tsai bfd/ * elf32-xtensa.c (is_resolvable_asm_expansion): Scan output sections between the call site and call destination and adjust call distance by the largest alignment. ld/ * testsuite/ld-xtensa/call_overflow.d: New test definition. * testsuite/ld-xtensa/call_overflow1.s: New test source. * testsuite/ld-xtensa/call_overflow2.s: New test source. * testsuite/ld-xtensa/call_overflow3.s: New test source. * testsuite/ld-xtensa/xtensa.exp: Add call_overflow test. --- ld/ChangeLog | 8 ++++++++ ld/testsuite/ld-xtensa/call_overflow.d | 7 +++++++ ld/testsuite/ld-xtensa/call_overflow1.s | 9 +++++++++ ld/testsuite/ld-xtensa/call_overflow2.s | 14 ++++++++++++++ ld/testsuite/ld-xtensa/call_overflow3.s | 5 +++++ ld/testsuite/ld-xtensa/xtensa.exp | 1 + 6 files changed, 44 insertions(+) create mode 100644 ld/testsuite/ld-xtensa/call_overflow.d create mode 100644 ld/testsuite/ld-xtensa/call_overflow1.s create mode 100644 ld/testsuite/ld-xtensa/call_overflow2.s create mode 100644 ld/testsuite/ld-xtensa/call_overflow3.s (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 508858f..0e00e41 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2019-02-20 Eric Tsai + + * testsuite/ld-xtensa/call_overflow.d: New test definition. + * testsuite/ld-xtensa/call_overflow1.s: New test source. + * testsuite/ld-xtensa/call_overflow2.s: New test source. + * testsuite/ld-xtensa/call_overflow3.s: New test source. + * testsuite/ld-xtensa/xtensa.exp: Add call_overflow test. + 2019-02-14 Thomas Schwinge * testsuite/ld-elf/elf.exp: Remove Hurd XFAILs. diff --git a/ld/testsuite/ld-xtensa/call_overflow.d b/ld/testsuite/ld-xtensa/call_overflow.d new file mode 100644 index 0000000..9572848 --- /dev/null +++ b/ld/testsuite/ld-xtensa/call_overflow.d @@ -0,0 +1,7 @@ +#source: call_overflow1.s +#source: call_overflow2.s +#source: call_overflow3.s +#as: --longcalls +#ld: +#objdump: -d +#... diff --git a/ld/testsuite/ld-xtensa/call_overflow1.s b/ld/testsuite/ld-xtensa/call_overflow1.s new file mode 100644 index 0000000..8b03289 --- /dev/null +++ b/ld/testsuite/ld-xtensa/call_overflow1.s @@ -0,0 +1,9 @@ + .text + .global _start + .align 4 +_start: + call8 a + .rep 2051 + nop.n + nop.n + .endr diff --git a/ld/testsuite/ld-xtensa/call_overflow2.s b/ld/testsuite/ld-xtensa/call_overflow2.s new file mode 100644 index 0000000..c3f36fa --- /dev/null +++ b/ld/testsuite/ld-xtensa/call_overflow2.s @@ -0,0 +1,14 @@ + .text + .global a + .align 4 +a: + j a + + .align 4 +x: + call8 b +#29 + .rep 131070 + nop.n + nop.n + .endr diff --git a/ld/testsuite/ld-xtensa/call_overflow3.s b/ld/testsuite/ld-xtensa/call_overflow3.s new file mode 100644 index 0000000..33f59d8 --- /dev/null +++ b/ld/testsuite/ld-xtensa/call_overflow3.s @@ -0,0 +1,5 @@ + .text + .align 32 + .global b +b: + j b diff --git a/ld/testsuite/ld-xtensa/xtensa.exp b/ld/testsuite/ld-xtensa/xtensa.exp index e8befa9..91b2314 100644 --- a/ld/testsuite/ld-xtensa/xtensa.exp +++ b/ld/testsuite/ld-xtensa/xtensa.exp @@ -23,6 +23,7 @@ if { !([istarget "xtensa*-*-*"]) } { return } +run_dump_test "call_overflow" run_dump_test "coalesce" run_dump_test "diff_overflow" run_dump_test "lcall" -- cgit v1.1