[lld] r282725 - Simplify. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 29 09:29:56 PDT 2016
Author: rafael
Date: Thu Sep 29 11:29:55 2016
New Revision: 282725
URL: http://llvm.org/viewvc/llvm-project?rev=282725&view=rev
Log:
Simplify. NFC.
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=282725&r1=282724&r2=282725&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Sep 29 11:29:55 2016
@@ -1190,15 +1190,14 @@ static uintX_t getFileAlignment(uintX_t
Alignment = std::max<uintX_t>(Alignment, Config->MaxPageSize);
Off = alignTo(Off, Alignment);
- // Relocatable output does not have program headers
- // and does not need any other offset adjusting.
- if (Config->Relocatable || !(Sec->getFlags() & SHF_ALLOC))
+ OutputSectionBase<ELFT> *First = Sec->FirstInPtLoad;
+ // If the section is not in a PT_LOAD, we have no other constraint.
+ if (!First)
return Off;
- OutputSectionBase<ELFT> *First = Sec->FirstInPtLoad;
// If two sections share the same PT_LOAD the file offset is calculated using
// this formula: Off2 = Off1 + (VA2 - VA1).
- if (!First || Sec == First)
+ if (Sec == First)
return alignTo(Off, Target->MaxPageSize, Sec->getVA());
return First->getFileOffset() + Sec->getVA() - First->getVA();
}
More information about the llvm-commits
mailing list