forked from OSchip/llvm-project
ELF: Move shouldUseRela to Writer.cpp.
The function was used only in Writer.cpp and did not depend on SymbolTable. There is no reason to have that function in SymbolTable.cpp. llvm-svn: 255850
This commit is contained in:
parent
25b44c9b2b
commit
6192c122f4
|
@ -28,11 +28,6 @@ using namespace lld::elf2;
|
|||
|
||||
template <class ELFT> SymbolTable<ELFT>::SymbolTable() {}
|
||||
|
||||
template <class ELFT> bool SymbolTable<ELFT>::shouldUseRela() const {
|
||||
ELFKind K = cast<ELFFileBase<ELFT>>(Config->FirstElf)->getELFKind();
|
||||
return K == ELF64LEKind || K == ELF64BEKind;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
static void checkCompatibility(InputFile *FileP) {
|
||||
auto *F = dyn_cast<ELFFileBase<ELFT>>(FileP);
|
||||
|
|
|
@ -36,8 +36,6 @@ public:
|
|||
|
||||
void addFile(std::unique_ptr<InputFile> File);
|
||||
|
||||
bool shouldUseRela() const;
|
||||
|
||||
const llvm::MapVector<StringRef, Symbol *> &getSymbols() const {
|
||||
return Symtab;
|
||||
}
|
||||
|
|
|
@ -95,6 +95,11 @@ private:
|
|||
};
|
||||
} // anonymous namespace
|
||||
|
||||
template <class ELFT> static bool shouldUseRela() {
|
||||
ELFKind K = cast<ELFFileBase<ELFT>>(Config->FirstElf)->getELFKind();
|
||||
return K == ELF64LEKind || K == ELF64BEKind;
|
||||
}
|
||||
|
||||
template <class ELFT> void lld::elf2::writeResult(SymbolTable<ELFT> *Symtab) {
|
||||
// Initialize output sections that are handled by Writer specially.
|
||||
// Don't reorder because the order of initialization matters.
|
||||
|
@ -127,7 +132,7 @@ template <class ELFT> void lld::elf2::writeResult(SymbolTable<ELFT> *Symtab) {
|
|||
GnuHashTableSection<ELFT> GnuHashTab;
|
||||
if (Config->GnuHash)
|
||||
Out<ELFT>::GnuHashTab = &GnuHashTab;
|
||||
bool IsRela = Symtab->shouldUseRela();
|
||||
bool IsRela = shouldUseRela<ELFT>();
|
||||
RelocationSection<ELFT> RelaDyn(IsRela ? ".rela.dyn" : ".rel.dyn", IsRela);
|
||||
Out<ELFT>::RelaDyn = &RelaDyn;
|
||||
RelocationSection<ELFT> RelaPlt(IsRela ? ".rela.plt" : ".rel.plt", IsRela);
|
||||
|
|
Loading…
Reference in New Issue