[PATCH] D75225: [ELF] Keep orphan section names (.rodata.foo .text.foo) unchanged if !hasSectionsCommand
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 27 00:33:02 PST 2020
grimar added inline comments.
================
Comment at: lld/ELF/Writer.cpp:136
if (s->name == "COMMON")
return ".bss";
----------------
2 questions regarding the current code.
1) Seems we always rename `COMMON` to `.bss`. Does not look right for the non-linker script case?
2) If (1) is true, what about doing in the following way?
```
if (script->hasSectionsCommand) {
// CommonSection is identified as "COMMON" in linker scripts.
// By default, it should go to .bss section.
if (s->name == "COMMON")
return ".bss";
return s->name;
}
// When no SECTIONS is specified, emulate GNU ld's internal linker scripts...
<code>
```
================
Comment at: lld/test/ELF/text-section-prefix.s:20
+# RUN: echo 'SECTIONS {}' > %t.script
+# RUN: ld.lld -T %t.script -z keep-text-section-prefix %t -o %t5
+# RUN: llvm-readelf -S %t5 | FileCheck --check-prefix=SCRIPT %s
----------------
Do you need -z keep-text-section-prefix? Seems both ld.bfd and ld.gold produce the same output without this option.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75225/new/
https://reviews.llvm.org/D75225
More information about the llvm-commits
mailing list