[lld] r298968 - Change the order of parameters. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 28 17:49:30 PDT 2017
Author: ruiu
Date: Tue Mar 28 19:49:29 2017
New Revision: 298968
URL: http://llvm.org/viewvc/llvm-project?rev=298968&view=rev
Log:
Change the order of parameters. NFC.
If a function takes a size and an alignment, we usually pass them
in that order instead of the reverse order.
Modified:
lld/trunk/ELF/Relocations.cpp
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/ELF/SyntheticSections.h
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=298968&r1=298967&r2=298968&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Tue Mar 28 19:49:29 2017
@@ -455,7 +455,7 @@ template <class ELFT> static void addCop
// 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
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=298968&r1=298967&r2=298968&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Mar 28 19:49:29 2017
@@ -75,11 +75,11 @@ template <class ELFT> InputSection *elf:
[](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.
@@ -367,7 +367,7 @@ void BuildIdSection::computeHash(
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;
Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=298968&r1=298967&r2=298968&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Tue Mar 28 19:49:29 2017
@@ -162,7 +162,7 @@ public:
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:
More information about the llvm-commits
mailing list