<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] [ELF] ld.lld reserves memory in the LMA region for NOBITS sections"
href="https://bugs.llvm.org/show_bug.cgi?id=38481">38481</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[LLD] [ELF] ld.lld reserves memory in the LMA region for NOBITS sections
</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>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>konstantin.schwarz@hightec-rt.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>In the following linker script, an LMA region is explicitly set for .sec1.
ld.lld expands that region subsequently, although .sec1 has only NOBITS
contents
MEMORY
{
RODATA : org = 0x08000000, len = 100K
DATA : org = 0x20000000, len = 100K
}
SECTIONS
{
.text : { } > RODATA
.sec1 : { . += 4K; } > DATA AT > RODATA
.sec2 : { . += 4K; } > DATA
.sec3 : { . += 4k; } > RODATA
}
readelf gives the following output:
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .text PROGBITS 0000000008000000 00001000
0000000000000000 0000000000000000 AX 0 0 4
[ 2] .sec1 NOBITS 0000000020000000 00001000
0000000000001000 0000000000000000 AX 0 0 1
[ 3] .sec2 NOBITS 0000000020001000 00001000
0000000000001000 0000000000000000 AX 0 0 1
[ 4] .sec3 NOBITS 0000000008001000 00001000
0000000000001000 0000000000000000 AX 0 0 1
[...]
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000001000 0x0000000020000000 0x0000000008000000
0x0000000000000000 0x0000000000002000 R E 1000
LOAD 0x0000000000001000 0x0000000008001000 0xfffffffff0001000
0x0000000000000000 0x0000000000001000 R E 1000
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RW 0
Section to Segment mapping:
Segment Sections...
00 .sec1 .sec2
01 .sec3
02
Although the file size of the first program header is 0, the virtual address of
the next header starts at 0x0000000008001000
Moreover, the physical address of the second program header seems wrong.</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>