<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 - Error when manually setting location counter"
href="https://bugs.llvm.org/show_bug.cgi?id=36535">36535</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Error when manually setting location counter
</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>Windows NT
</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>konstantin.schwarz@hightec-rt.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Consider the following assembly file:
// test.s
.text
.globl _start
_start:
.section .foo.1,"a"
.quad 1
.section .foo.2,"a"
.quad 2
// linker.script
MEMORY
{
ram (rwx): org = 0x0, len = 32K
}
SECTIONS
{
.foo.1 :
{
*(.foo.1)
. += 0x1000;
} > ram
.foo.2 :
{
*(.foo.2)
} > ram
}
In the ".foo.1" output section, the location counter is incremented by 0x1000
to reserve additional memory.
Linking this example with ld.bfd results in no error and the following layout:
Name Origin Length Attributes
ram 0x0000000000000000 0x0000000000008000 xrw
*default* 0x0000000000000000 0xffffffffffffffff
Linker script and memory map
.text 0x0000000000000000 0x0
.text 0x0000000000000000 0x0 test.o
.foo.1 0x0000000000000000 0x1008
*(.foo.1)
.foo.1 0x0000000000000000 0x8 test.o
0x0000000000001008 . = (. + 0x1000)
*fill* 0x0000000000000008 0x1000
.foo.2 0x0000000000001008 0x8
*(.foo.2)
.foo.2 0x0000000000001008 0x8 test.o
Linking with ld.lld returns the following errors:
ld.lld: error: section .foo.1 file range overlaps with .foo.2
<span class="quote">>>> .foo.1 range is [0x1000 -> 0x2007]
>>> .foo.2 range is [0x1008 -> 0x100F]</span >
ld.lld: error: section .foo.1 file range overlaps with .comment
<span class="quote">>>> .foo.1 range is [0x1000 -> 0x2007]
>>> .comment range is [0x1010 -> 0x1085]</span >
ld.lld: error: section .foo.1 file range overlaps with .symtab
<span class="quote">>>> .foo.1 range is [0x1000 -> 0x2007]
>>> .symtab range is [0x1088 -> 0x10B7]</span >
ld.lld: error: section .foo.1 file range overlaps with .shstrtab
<span class="quote">>>> .foo.1 range is [0x1000 -> 0x2007]
>>> .shstrtab range is [0x10B8 -> 0x10EF]</span >
ld.lld: error: section .foo.1 file range overlaps with .strtab
<span class="quote">>>> .foo.1 range is [0x1000 -> 0x2007]
>>> .strtab range is [0x10F0 -> 0x10F7]</span >
ld.lld: error: section .foo.1 virtual address range overlaps with .foo.2
<span class="quote">>>> .foo.1 range is [0x0 -> 0x1007]
>>> .foo.2 range is [0x8 -> 0xF]</span >
ld.lld: error: section .foo.1 load address range overlaps with .foo.2
<span class="quote">>>> .foo.1 range is [0x0 -> 0x1007]
>>> .foo.2 range is [0x8 -> 0xF]</span ></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>