summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-03-14 22:41:08 +0000
committerRui Ueyama <ruiu@google.com>2016-03-14 22:41:08 +0000
commitf50e1d8358103ef158d4ee6f9263e673d7515631 (patch)
tree5e0cc81f86355532889efc79c4474470827be150
parent6be355961e8e9aa9f8da76a907c2a1788fd06ba5 (diff)
downloadbcm5719-llvm-f50e1d8358103ef158d4ee6f9263e673d7515631.tar.gz
bcm5719-llvm-f50e1d8358103ef158d4ee6f9263e673d7515631.zip
Make getAlignment a non-member function. NFC.
This function did not rely on Writer class. llvm-svn: 263502
-rw-r--r--lld/ELF/Writer.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 315c2dfb146..f0e16bec73f 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -89,8 +89,6 @@ private:
void addCommonSymbols(std::vector<DefinedCommon *> &Syms);
void addCopyRelSymbols(std::vector<SharedSymbol<ELFT> *> &Syms);
- static uint32_t getAlignment(SharedSymbol<ELFT> *SS);
-
std::unique_ptr<llvm::FileOutputBuffer> Buffer;
BumpPtrAllocator Alloc;
@@ -719,13 +717,13 @@ void Writer<ELFT>::addCommonSymbols(std::vector<DefinedCommon *> &Syms) {
Out<ELFT>::Bss->setSize(Off);
}
-template <class ELFT>
-uint32_t Writer<ELFT>::getAlignment(SharedSymbol<ELFT> *SS) {
- const Elf_Sym &Sym = SS->Sym;
- const Elf_Shdr *Sec = SS->File->getSection(Sym);
- uintX_t SecAlign = Sec->sh_addralign;
+template <class ELFT> static uint32_t getAlignment(SharedSymbol<ELFT> *SS) {
+ typedef typename ELFFile<ELFT>::uintX_t uintX_t;
+
+ uintX_t SecAlign = SS->File->getSection(SS->Sym)->sh_addralign;
+ uintX_t SymValue = SS->Sym.st_value;
int TrailingZeros = std::min(countTrailingZeros(SecAlign),
- countTrailingZeros((uintX_t)Sym.st_value));
+ countTrailingZeros(SymValue));
return 1 << TrailingZeros;
}
OpenPOWER on IntegriCloud