<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - ARM: Add range thunk support to avoid relocation R_ARM_THM_CALL out of range"
href="https://bugs.llvm.org/show_bug.cgi?id=33612">33612</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ARM: Add range thunk support to avoid relocation R_ARM_THM_CALL out of range
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>ELF
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>peter.smith@linaro.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The range of ARM branch instructions is limited. The ABI allows object
producers to assume that a linker can extend the range of branches via the use
of range extension thunks/stubs/veneers. These are pieces of code that are
inserted between branches that turn a range limited direct call into (usually)
an indirect call via the register r12 (ABI reserved).
lld does not currently implement range extension thunks so we can quite easily
write a program that has a relocation out of range error.
.syntax unified
.thumb
.section .text.1 ,"ax", %progbits
.global low
.type low, %function
low:
bl high
bx lr
// Thumb2 branch range is 16Mb
.space 20 * 1024 * 1024
.section .text.2 ,"ax", %progbits
.global high
.type high, %function
high:
bl low
bx lr
llvm-mc -triple=armv7a-linux-gnueabihf long.s -filetype=obj -o long.o
ld.lld long.o -o long.axf
error: long.o:(.text.2+0x0): relocation R_ARM_THM_CALL out of range
error: long.o:(.text.1+0x0): relocation R_ARM_THM_CALL out of range
Range thunks are currently in review, this pr is here so that if people run
into the relocation R_ARM_THM_CALL they know that work is in progress to
support it.
Initial set of upstream Reviews:
D34035 [LLD][ELF] Introduce Thunk reuse compatibility (1/11).
D34037 [LLD][ELF] Allow multiple thunks to be added for a symbol. (2/11)
D34344 [LLD][ELF] Extract allocateHeaders() from assignAddresses() (3/11)
D34345 [LLD][ELF] Reset any accumulated state before calculating addresses
(4/11)
D34688 [LLD][ELF] Add call to assignAddresses() before createThunks() [NFC]
(5/11)
D34689 [LLD][ELF] Pre-create ThunkSections at Target specific intervals (6/11)
D34690 [LLD][ELF] Introduce target specific inBranchRange() function (7/11)
D34691 [LLD][ELF] Introduce range extension thunks for ARM (8/11)
D34692 [LLD][ELF] Add support for multiple passes to createThunks() (9/11)
D31666 [LLD][ELF] Add test cases for range extension thunks using linker
scripts (10/11)
D31665 [LLD][ELF] Add test cases for range extension thunks (no linkerscripts)
(11/11)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>