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: unassignedb...@nondot.org
Reporter: schultetw...@gmail.com
CC: llvm-bugs@lists.llvm.org, smithp...@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\",@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs