[lld] r250462 - ELF2: Move HashTableSection::hash out of the class.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 15 14:27:18 PDT 2015
Author: ruiu
Date: Thu Oct 15 16:27:17 2015
New Revision: 250462
URL: http://llvm.org/viewvc/llvm-project?rev=250462&view=rev
Log:
ELF2: Move HashTableSection::hash out of the class.
Because the function does not depend on the class.
Modified:
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/OutputSections.h
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=250462&r1=250461&r2=250462&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Thu Oct 15 16:27:17 2015
@@ -194,6 +194,18 @@ HashTableSection<ELFT>::HashTableSection
this->Header.sh_addralign = sizeof(Elf_Word);
}
+static uint32_t hash(StringRef Name) {
+ uint32_t H = 0;
+ for (char C : Name) {
+ H = (H << 4) + C;
+ uint32_t G = H & 0xf0000000;
+ if (G)
+ H ^= G >> 24;
+ H &= ~G;
+ }
+ return H;
+}
+
template <class ELFT> void HashTableSection<ELFT>::addSymbol(SymbolBody *S) {
StringRef Name = S->getName();
Out<ELFT>::DynSymTab->addSymbol(Name);
Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=250462&r1=250461&r2=250462&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Thu Oct 15 16:27:17 2015
@@ -237,17 +237,6 @@ public:
void writeTo(uint8_t *Buf) override;
private:
- uint32_t hash(StringRef Name) {
- uint32_t H = 0;
- for (char C : Name) {
- H = (H << 4) + C;
- uint32_t G = H & 0xf0000000;
- if (G)
- H ^= G >> 24;
- H &= ~G;
- }
- return H;
- }
std::vector<uint32_t> Hashes;
};
More information about the llvm-commits
mailing list