[PATCH] D37746: [ELF] - Refactor of Writer<ELFT>::forEachRelSec.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 13 00:56:22 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL313127: [ELF] - Refactor of Writer<ELFT>::forEachRelSec. (authored by grimar).
Changed prior to commit:
https://reviews.llvm.org/D37746?vs=114843&id=114990#toc
Repository:
rL LLVM
https://reviews.llvm.org/D37746
Files:
lld/trunk/ELF/Writer.cpp
Index: lld/trunk/ELF/Writer.cpp
===================================================================
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -880,24 +880,16 @@
template <class ELFT>
void Writer<ELFT>::forEachRelSec(std::function<void(InputSectionBase &)> Fn) {
- for (InputSectionBase *IS : InputSections) {
- if (!IS->Live)
- continue;
- // Scan all relocations. Each relocation goes through a series
- // of tests to determine if it needs special treatment, such as
- // creating GOT, PLT, copy relocations, etc.
- // Note that relocations for non-alloc sections are directly
- // processed by InputSection::relocateNonAlloc.
- if (!(IS->Flags & SHF_ALLOC))
- continue;
- if (isa<InputSection>(IS) || isa<EhInputSection>(IS))
+ // Scan all relocations. Each relocation goes through a series
+ // of tests to determine if it needs special treatment, such as
+ // creating GOT, PLT, copy relocations, etc.
+ // Note that relocations for non-alloc sections are directly
+ // processed by InputSection::relocateNonAlloc.
+ for (InputSectionBase *IS : InputSections)
+ if (IS->Live && isa<InputSection>(IS) && (IS->Flags & SHF_ALLOC))
Fn(*IS);
- }
-
- if (!Config->Relocatable) {
- for (EhInputSection *ES : In<ELFT>::EhFrame->Sections)
- Fn(*ES);
- }
+ for (EhInputSection *ES : In<ELFT>::EhFrame->Sections)
+ Fn(*ES);
}
template <class ELFT> void Writer<ELFT>::createSections() {
@@ -1280,7 +1272,8 @@
// Scan relocations. This must be done after every symbol is declared so that
// we can correctly decide if a dynamic relocation is needed.
- forEachRelSec(scanRelocations<ELFT>);
+ if (!Config->Relocatable)
+ forEachRelSec(scanRelocations<ELFT>);
if (InX::Plt && !InX::Plt->empty())
InX::Plt->addSymbols();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37746.114990.patch
Type: text/x-patch
Size: 1826 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170913/4360ff7e/attachment.bin>
More information about the llvm-commits
mailing list