Issue |
81657
|
Summary |
[lld] promoting bss sections to progbits may increase runtime memory usage
|
Labels |
lld
|
Assignees |
|
Reporter |
shankarke
|
lld tries to promote nobits sections to progbits sections in the following test, causing a size increase.
Checking to see if this is a documented behavior or a bug with lld that we can work on for fixing it.
$ ld.lld --version
LLD 18.0.0 (compatible with GNU linkers)
`
cat > 1.c << \!
int foo() {
return 0;
}
int bar() {
return 0;
}
!
cat > script.t << \!
PHDRS {
A PT_LOAD;
}
SECTIONS {
.foo : { *(.text) *(.text.foo) } :A
.b1 : { . = . + 100; } :A
.b2 : { . = . + 100; } :A
.bar : { *(.text.bar) } :A
.b3 : { . = . + 1M;} : A
.b4 : { . = . + 1M;} : A
}
!
clang -target riscv32 -c 1.c -ffunction-sections -fno-asynchronous-unwind-tables
ld.lld 1.o -T script.t
`
The sections .b1 and .b2 should get promoted to PROGBITS, but .b3 and .b4 should be left as is as NOBITS.
This increases the size of the image.
For comparison :-
lld generates a 2.1M image
bfd generated an image in kilobytes.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs