[PATCH] D23352: [ELF] - Linkerscript: implemented simple heuristic for placing orphan sections.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 16 03:22:54 PDT 2016
grimar added inline comments.
================
Comment at: ELF/LinkerScript.cpp:283
@@ +282,3 @@
+ [&](OutputSectionBase<ELFT> *S) {
+ return getPermissions(S) == getPermissions(OutSec);
+ });
----------------
silvas wrote:
> I think this also needs to check `&& !(S->getType() & SHT_NOBITS)` so that we don't add a PROGBITS section into BSS.
>
> E.g. with this patch applied I get this error during a FreeBSD kernel build:
>
> ```
> BFD: stc5VrZP: section set_pcpu lma 0xffffffff81529d80 overlaps previous sections
> BFD: stc5VrZP: section `set_pcpu' can't be allocated in segment 5
> objcopy: stc5VrZP: Bad value
> BFD: stc5VrZP: section set_pcpu lma 0xffffffff81529d80 overlaps previous sections
> BFD: stc5VrZP: section `set_pcpu' can't be allocated in segment 5
> objcopy: stc5VrZP: Bad value
> *** Error code 1
> ```
>
> Relevant section of `readelf --sections` output on the binary produced by this patch:
> ```
> [33] .data PROGBITS ffffffff81401000 01015000
> 000000000012823c 0000000000000000 WA 0 0 32
> [34] .bss NOBITS ffffffff81529280 0113d23c
> 0000000000207ad0 0000000000000000 WA 0 0 128
> [35] set_pcpu PROGBITS ffffffff81730d80 0113dd80
> 00000000000010b0 0000000000000000 WA 0 0 128
> ```
Done, thanks !
================
Comment at: ELF/LinkerScript.cpp:303
@@ +302,3 @@
+ ScriptConfig->Commands.emplace(I + 1, Cmd);
+}
+
----------------
ruiu wrote:
> I think I understand what you are trying to do, but still it seems a bit too complicated. Isn't there any way to simplify?
I refactored that.
Though there are probably not much space to simplify since
I need to insert different things into two different async lists.
https://reviews.llvm.org/D23352
More information about the llvm-commits
mailing list