[llvm-bugs] [Bug 45336] New: Output sections marked NOLOAD with no input sections are given type SHT_PROGBITS
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Mar 28 01:14:10 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45336
Bug ID: 45336
Summary: Output sections marked NOLOAD with no input sections
are given type SHT_PROGBITS
Product: lld
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: schultetwin1 at gmail.com
CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com
lld will ignore the NOLOAD annotation of output sections which have no
associated inputs sections.
Repro steps
1. Create a linker script with two output sections. One that contains an input
section and one that contains no input sections. The later should be marked as
NOLOAD.
```bash
echo "SECTIONS {
.text : { *(.text) }
.data_noload (NOLOAD) : { . += 1; }
};" > tmp.script
```
2. Create an output object which has some data in it
```bash
echo ".section .text,\"ax\", at progbits
nop" > tmp.asm
llvm-mc -filetype=obj -triple=x86_64-unknown-linux tmp.asm -o tmp.o
```
3) Link the object file using the script
```bash
ld.lld -o tmp --script tmp.script tmp.o
```
4) Use readelf to dump the sections
```bash
llvm-readelf tmp -S -l
```
I expect to see .data_noload marked as NOBITS but instead I see it marked as
PROGBITS.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200328/6e216106/attachment.html>
More information about the llvm-bugs
mailing list