[PATCH] D50688: [LLD] Warn if non-alloc sections occur before alloc sections in linker scripts
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 17 02:37:52 PDT 2018
grimar added inline comments.
================
Comment at: ELF/Writer.cpp:1616
+ if (!(OS->Flags & SHF_ALLOC) && (OS->SectionIndex != UINT32_MAX))
+ NonAllocSec = OS;
+ else if (NonAllocSec && (OS->SectionIndex != UINT32_MAX)) {
----------------
In according to LLD code style, you should add `{}` here and above, because `else` below use them.
================
Comment at: ELF/Writer.cpp:1621
+ NonAllocSec = nullptr;
+ }
+
----------------
I think `Writer<ELFT>::checkSections()` is the correct place for this code. Can it be moved there?
(I also think you'll be able to simplify the conditions a bit, to remove `OS->SectionIndex` check).
================
Comment at: test/ELF/linkerscript/non-alloc.test:12
+
+# .other is a non-alloc section and therefore should be placed after .text.
+# Expect a warning for this section as it prevents the creation of correct
----------------
I would clarify a bit: `should be placed` -> `should be placed in script`.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D50688
More information about the llvm-commits
mailing list