forked from OSchip/llvm-project
Remove OutputSection::updateAlignment.
I feel it is easier to understand without this function. llvm-svn: 315140
This commit is contained in:
parent
c8e0f79b90
commit
8befefb2ea
|
@ -688,7 +688,8 @@ void LinkerScript::adjustSectionsAfterSorting() {
|
|||
Sec->MemRegion = findMemoryRegion(Sec);
|
||||
// Handle align (e.g. ".foo : ALIGN(16) { ... }").
|
||||
if (Sec->AlignExpr)
|
||||
Sec->updateAlignment(Sec->AlignExpr().getValue());
|
||||
Sec->Alignment =
|
||||
std::max<uint32_t>(Sec->Alignment, Sec->AlignExpr().getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ void OutputSection::addSection(InputSection *IS) {
|
|||
|
||||
IS->Parent = this;
|
||||
Flags |= IS->Flags;
|
||||
this->updateAlignment(IS->Alignment);
|
||||
Alignment = std::max(Alignment, IS->Alignment);
|
||||
|
||||
// The actual offsets will be computed by assignAddresses. For now, use
|
||||
// crude approximation so that it is at least easy for other code to know the
|
||||
|
|
|
@ -56,11 +56,6 @@ public:
|
|||
|
||||
uint32_t getPhdrFlags() const;
|
||||
|
||||
void updateAlignment(uint32_t Val) {
|
||||
if (Val > Alignment)
|
||||
Alignment = Val;
|
||||
}
|
||||
|
||||
// Pointer to the PT_LOAD segment, which this section resides in. This field
|
||||
// is used to correctly compute file offset of a section. When two sections
|
||||
// share the same load segment, difference between their file offsets should
|
||||
|
|
|
@ -363,7 +363,7 @@ void BuildIdSection::computeHash(
|
|||
BssSection::BssSection(StringRef Name, uint64_t Size, uint32_t Alignment)
|
||||
: SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_NOBITS, Alignment, Name) {
|
||||
if (OutputSection *Sec = getParent())
|
||||
Sec->updateAlignment(Alignment);
|
||||
Sec->Alignment = std::max(Sec->Alignment, Alignment);
|
||||
this->Size = Size;
|
||||
}
|
||||
|
||||
|
@ -494,8 +494,10 @@ template <class ELFT>
|
|||
void EhFrameSection<ELFT>::addSection(InputSectionBase *C) {
|
||||
auto *Sec = cast<EhInputSection>(C);
|
||||
Sec->Parent = this;
|
||||
updateAlignment(Sec->Alignment);
|
||||
|
||||
Alignment = std::max(Alignment, Sec->Alignment);
|
||||
Sections.push_back(Sec);
|
||||
|
||||
for (auto *DS : Sec->DependentSections)
|
||||
DependentSections.push_back(DS);
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ template <class ELFT> void Writer<ELFT>::createSyntheticSections() {
|
|||
Out::ElfHeader = make<OutputSection>("", 0, SHF_ALLOC);
|
||||
Out::ElfHeader->Size = sizeof(Elf_Ehdr);
|
||||
Out::ProgramHeaders = make<OutputSection>("", 0, SHF_ALLOC);
|
||||
Out::ProgramHeaders->updateAlignment(Config->Wordsize);
|
||||
Out::ProgramHeaders->Alignment = Config->Wordsize;
|
||||
|
||||
if (needsInterpSection()) {
|
||||
InX::Interp = createInterpSection();
|
||||
|
|
Loading…
Reference in New Issue