// memory protection by reserving space in the .bss.rel.ro section.
bool IsReadOnly = isReadOnly<ELFT>(SS);
BssSection *Sec = IsReadOnly ? In<ELFT>::BssRelRo : In<ELFT>::Bss;
- uintX_t Off = Sec->reserveSpace(SS->getAlignment<ELFT>(), SymSize);
+ uintX_t Off = Sec->reserveSpace(SymSize, SS->getAlignment<ELFT>());
// Look through the DSO's dynamic symbol table for aliases and create a
// dynamic symbol for each one. This causes the copy relocation to correctly
[](const DefinedCommon *A, const DefinedCommon *B) {
return A->Alignment > B->Alignment;
});
- BssSection *Ret = make<BssSection>("COMMON");
- for (DefinedCommon *Sym : Syms)
- Sym->Offset = Ret->reserveSpace(Sym->Alignment, Sym->Size);
- return Ret;
+ BssSection *Sec = make<BssSection>("COMMON");
+ for (DefinedCommon *Sym : Syms)
+ Sym->Offset = Sec->reserveSpace(Sym->Size, Sym->Alignment);
+ return Sec;
}
// Returns an LLD version string.
BssSection::BssSection(StringRef Name)
: SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_NOBITS, 0, Name) {}
-size_t BssSection::reserveSpace(uint32_t Alignment, size_t Size) {
+size_t BssSection::reserveSpace(size_t Size, uint32_t Alignment) {
if (OutSec)
OutSec->updateAlignment(Alignment);
this->Size = alignTo(this->Size, Alignment) + Size;
BssSection(StringRef Name);
void writeTo(uint8_t *) override {}
bool empty() const override { return getSize() == 0; }
- size_t reserveSpace(uint32_t Alignment, size_t Size);
+ size_t reserveSpace(size_t Size, uint32_t Alignment);
size_t getSize() const override { return Size; }
private: