<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 - [linker script] dot should be relative to memory region's origin"
href="https://bugs.llvm.org/show_bug.cgi?id=43083">43083</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[linker script] dot should be relative to memory region's origin
</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>ruiu@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
</td>
</tr></table>
<p>
<div>
<pre>The following test demonstrates an issue of the lld's linker script processor.
BFD linker handles the dot in a memory region as a relative address from the
beginning of the memory region, so `. = 0x1000` moves the dot to 0x43000.
lld handles the dot as an absolute value, so assigning 0x1000 to the dot is
considered to be moving the dot backwards from 0x42004 to 0x1000, causing an
error.
I think there are a few different ways to fix this issue, but I'm not sure what
is the best/easiest way to do that.
# REQUIRES: x86
# RUN: echo '.section .foo,"a"; .quad 1; .section .bar,"a"; .quad 1' \
# RUN: | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t.o
# RUN: ld.bfdx -o %t.so --script %s %t.o
# RUN: llvm-readobj -symbols %t.so | FileCheck %s
# CHECK: 0000000000042000 .baz 00000000 foo
# CHECK: 0000000000043000 .baz 00000000 bar
MEMORY {
rom : ORIGIN = 0x42000, LENGTH = 0x100000
}
SECTIONS {
.baz : {
foo = .;
*(.foo)
. = 0x1000;
bar = .;
*(.bar)
} > rom
}</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>