summaryrefslogtreecommitdiffstats
path: root/lld/ELF/SymbolTable.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-12-16 23:31:22 +0000
committerRui Ueyama <ruiu@google.com>2015-12-16 23:31:22 +0000
commit25b44c9b2bd7259a0d0a44ac30101371ae263e85 (patch)
tree702843d7aae9f84bf22837e5cc80fb3d6a27266f /lld/ELF/SymbolTable.cpp
parent5281686cddaa2171d46a1d3af2af3e6178e7fc17 (diff)
downloadbcm5719-llvm-25b44c9b2bd7259a0d0a44ac30101371ae263e85.tar.gz
bcm5719-llvm-25b44c9b2bd7259a0d0a44ac30101371ae263e85.zip
ELF: Make checkCompatibility a non-member function.
Because the function does not use any member of SymbolTable class. llvm-svn: 255849
Diffstat (limited to 'lld/ELF/SymbolTable.cpp')
-rw-r--r--lld/ELF/SymbolTable.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index 61826cbf525..ebb13af0577 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -34,9 +34,23 @@ template <class ELFT> bool SymbolTable<ELFT>::shouldUseRela() const {
}
template <class ELFT>
+static void checkCompatibility(InputFile *FileP) {
+ auto *F = dyn_cast<ELFFileBase<ELFT>>(FileP);
+ if (!F)
+ return;
+ if (F->getELFKind() == Config->EKind && F->getEMachine() == Config->EMachine)
+ return;
+ StringRef A = F->getName();
+ StringRef B = Config->Emulation;
+ if (B.empty())
+ B = Config->FirstElf->getName();
+ error(A + " is incompatible with " + B);
+}
+
+template <class ELFT>
void SymbolTable<ELFT>::addFile(std::unique_ptr<InputFile> File) {
- checkCompatibility(File);
InputFile *FileP = File.release();
+ checkCompatibility<ELFT>(FileP);
// .a file
if (auto *F = dyn_cast<ArchiveFile>(FileP)) {
@@ -209,20 +223,6 @@ template <class ELFT> void SymbolTable<ELFT>::addLazy(Lazy *L) {
}
template <class ELFT>
-void SymbolTable<ELFT>::checkCompatibility(std::unique_ptr<InputFile> &File) {
- auto *E = dyn_cast<ELFFileBase<ELFT>>(File.get());
- if (!E)
- return;
- if (E->getELFKind() == Config->EKind && E->getEMachine() == Config->EMachine)
- return;
- StringRef A = E->getName();
- StringRef B = Config->Emulation;
- if (B.empty())
- B = Config->FirstElf->getName();
- error(A + " is incompatible with " + B);
-}
-
-template <class ELFT>
void SymbolTable<ELFT>::addMemberFile(Undefined<ELFT> *Undef, Lazy *L) {
// Weak undefined symbols should not fetch members from archives.
// If we were to keep old symbol we would not know that an archive member was
OpenPOWER on IntegriCloud