forked from OSchip/llvm-project
parent
4e96895385
commit
c94678bf72
|
@ -1190,15 +1190,14 @@ static uintX_t getFileAlignment(uintX_t Off, OutputSectionBase<ELFT> *Sec) {
|
|||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue