<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 - LLD is not assigning an OutputSection of type OVERLAY an address."
href="https://bugs.llvm.org/show_bug.cgi?id=42006">42006</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLD is not assigning an OutputSection of type OVERLAY an address.
</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>normal
</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, peter.smith@linaro.org
</td>
</tr></table>
<p>
<div>
<pre>When attempting to test Thunk reuse between two OVERLAY OutputSections which we
shouldn't do as only one will be in memory at a time I came across a relocation
out of range error as Thunks were not created at all. On further inspection the
LMA and VMA expressions were all ignored with 0 being the result.
I think that this is due to the requirement of OVERLAY to clear the SHF_ALLOC
flag on the OutputSection. This seems to prevent Thunk Creation and causes the
LMA and VMA to be ignored.
cat overlay.s
.section .sec1, "ax", %progbits
bl far
.section .sec2, "ax", %progbits
bl far
.section .sec3, "ax", %progbits
.globl far
.type far, %function
far: bx lr
cat overlay.lds
SECTIONS {
.sec1 0x1000 (OVERLAY) : AT (0x1000) { *(.sec1) }
.sec2 0x1000 (OVERLAY) : AT (0x2000) { *(.sec2) }
.far 0x10000000 : { *(.sec3) }
}
llvm-mc --triple=armv7-a-linux-gnueabihf overlay.s -filetype=obj -o overlay.o
ld.lld overlay.o --script overlay.lds
ld.lld: error: overlay.o:(.sec1+0x0): relocation R_ARM_CALL out of range:
268435448 is not in [-33554432, 33554431]
ld.lld: error: overlay.o:(.sec2+0x0): relocation R_ARM_CALL out of range:
268435448 is not in [-33554432, 33554431]
cat overlay2.lds
SECTIONS {
.sec1 0x1000 (OVERLAY) : AT (0x1000) { *(.sec1) }
.sec2 0x1000 (OVERLAY) : AT (0x2000) { *(.sec2) }
.far 0x3000 : { *(.sec3) }
}
ld.lld overlay.o --script overlay2.lds -o overlay --print-map
VMA LMA Size Align Out In Symbol
0 0 4 1 .sec1
0 0 4 1 overlay.o:(.sec1)
0 0 0 1 $a.0
0 0 4 1 .sec2
0 0 4 1 overlay.o:(.sec2)
0 0 0 1 $a.1
0 0 7a 1 .comment
0 0 7a 1 <internal>:(.comment)
0 0 50 4 .symtab
0 0 50 4 <internal>:(.symtab)
0 0 3b 1 .shstrtab
0 0 3b 1 <internal>:(.shstrtab)
0 0 14 1 .strtab
0 0 14 1 <internal>:(.strtab)
3000 3000 4 1 .far
3000 3000 4 1 overlay.o:(.sec3)
3000 3000 0 1 $a.2
3000 3000 0 1 far
3004 3004 0 4 .text
3004 3004 0 4 overlay.o:(.text)
This is in contrast with arm-linux-gnueabihf-ld.bfd
LOAD overlay.o
.sec1 0x0000000000001000 0x10
*(.sec1)
.sec1 0x0000000000001000 0x4 overlay.o
*fill* 0x0000000000001004 0x4
.sec1.__stub 0x0000000000001008 0x8 linker stubs
.sec2 0x0000000000001000 0x10 load address 0x0000000000002000
*(.sec2)
.sec2 0x0000000000001000 0x4 overlay.o
*fill* 0x0000000000001004 0x4
.sec2.__stub 0x0000000000001008 0x8 linker stubs
.far 0x0000000010000000 0x4 load address 0x0000000010001000
*(.sec3)
.sec3 0x0000000010000000 0x4 overlay.o
0x0000000010000000 far
Note that ld.bfd has removed the SHF_ALLOC after assigning addresses and has
created stubs (thunks) in each overlay as we would expect.
In summary I think:
-LLD should not hard-code the address of a non-alloc section to 0.
-LLD should permit thunks to be generated from OVERLAY regions.
-LLD should prohibit thunks from being shared with an OVERLAY region.</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>