[PATCH] D60273: [ELF] Change findOrphanPos to only consider live sections
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 23 05:18:11 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD358979: [ELF] Change findOrphanPos to only consider live sections (authored by anng, committed by ).
Herald added a project: LLVM.
Changed prior to commit:
https://reviews.llvm.org/D60273?vs=193734&id=196218#toc
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60273/new/
https://reviews.llvm.org/D60273
Files:
ELF/Writer.cpp
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -1094,16 +1094,19 @@
int Proximity = getRankProximity(Sec, *I);
for (; I != E; ++I) {
auto *CurSec = dyn_cast<OutputSection>(*I);
- if (!CurSec)
+ if (!CurSec || !CurSec->Live)
continue;
if (getRankProximity(Sec, CurSec) != Proximity ||
Sec->SortRank < CurSec->SortRank)
break;
}
- auto IsOutputSec = [](BaseCommand *Cmd) { return isa<OutputSection>(Cmd); };
+ auto IsLiveOutputSec = [](BaseCommand *Cmd) {
+ auto *OS = dyn_cast<OutputSection>(Cmd);
+ return OS && OS->Live;
+ };
auto J = std::find_if(llvm::make_reverse_iterator(I),
- llvm::make_reverse_iterator(B), IsOutputSec);
+ llvm::make_reverse_iterator(B), IsLiveOutputSec);
I = J.base();
// As a special case, if the orphan section is the last section, put
@@ -1111,7 +1114,7 @@
// This matches bfd's behavior and is convenient when the linker script fully
// specifies the start of the file, but doesn't care about the end (the non
// alloc sections for example).
- auto NextSec = std::find_if(I, E, IsOutputSec);
+ auto NextSec = std::find_if(I, E, IsLiveOutputSec);
if (NextSec == E)
return E;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60273.196218.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190423/cee0ab29/attachment.bin>
More information about the llvm-commits
mailing list