From c95671bd788a32d2e7defce13414bdc82ee82bfd Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 29 Mar 2017 00:49:29 +0000 Subject: [PATCH] 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. llvm-svn: 298968 --- lld/ELF/Relocations.cpp | 2 +- lld/ELF/SyntheticSections.cpp | 10 +++++----- lld/ELF/SyntheticSections.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 9a1da2386725..84d93e73b0df 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -455,7 +455,7 @@ template static void addCopyRelSymbol(SharedSymbol *SS) { // memory protection by reserving space in the .bss.rel.ro section. bool IsReadOnly = isReadOnly(SS); BssSection *Sec = IsReadOnly ? In::BssRelRo : In::Bss; - uintX_t Off = Sec->reserveSpace(SS->getAlignment(), SymSize); + uintX_t Off = Sec->reserveSpace(SymSize, SS->getAlignment()); // 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 diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 5a7e73bb9a63..a804de6a01ae 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -75,11 +75,11 @@ template InputSection *elf::createCommonSection() { [](const DefinedCommon *A, const DefinedCommon *B) { return A->Alignment > B->Alignment; }); - BssSection *Ret = make("COMMON"); - for (DefinedCommon *Sym : Syms) - Sym->Offset = Ret->reserveSpace(Sym->Alignment, Sym->Size); - return Ret; + BssSection *Sec = make("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; diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h index c136f35f47f0..32bd3db1236e 100644 --- a/lld/ELF/SyntheticSections.h +++ b/lld/ELF/SyntheticSections.h @@ -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: