diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-11-24 20:59:44 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-11-24 20:59:44 +0000 |
| commit | 26081caf48a27d3de628db201fe71cc6a0fda356 (patch) | |
| tree | 5e0d425fc37105af50ba069480630c8d33bc1b05 | |
| parent | d4c94d18993ad65b1ced34c0f3853dcd5a147a13 (diff) | |
| download | bcm5719-llvm-26081caf48a27d3de628db201fe71cc6a0fda356.tar.gz bcm5719-llvm-26081caf48a27d3de628db201fe71cc6a0fda356.zip | |
Use toString() to report incompatible files.
llvm-svn: 287901
| -rw-r--r-- | lld/ELF/SymbolTable.cpp | 11 | ||||
| -rw-r--r-- | lld/test/ELF/incompatible-ar-first.s | 2 | ||||
| -rw-r--r-- | lld/test/ELF/incompatible.s | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index 2771e401266..31e7f770b21 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -35,17 +35,18 @@ using namespace lld::elf; template <class ELFT> static bool isCompatible(InputFile *F) { if (!isa<ELFFileBase<ELFT>>(F) && !isa<BitcodeFile>(F)) return true; + if (F->EKind == Config->EKind && F->EMachine == Config->EMachine) { if (Config->EMachine != EM_MIPS) return true; if (isMipsN32Abi(F) == Config->MipsN32Abi) return true; } - StringRef A = F->getName(); - StringRef B = Config->Emulation; - if (B.empty()) - B = Config->FirstElf->getName(); - error(A + " is incompatible with " + B); + + if (!Config->Emulation.empty()) + error(toString(F) + " is incompatible with " + Config->Emulation); + else + error(toString(F) + " is incompatible with " + toString(Config->FirstElf)); return false; } diff --git a/lld/test/ELF/incompatible-ar-first.s b/lld/test/ELF/incompatible-ar-first.s index 8a8aaec220d..e076561d11a 100644 --- a/lld/test/ELF/incompatible-ar-first.s +++ b/lld/test/ELF/incompatible-ar-first.s @@ -6,6 +6,6 @@ // We used to crash when // * The first object seen by the symbol table is from an archive. // * -m was not used. -// CHECK: a.o is incompatible with {{.*}}b.o +// CHECK: .a({{.*}}a.o) is incompatible with {{.*}}b.o // REQUIRES: x86 diff --git a/lld/test/ELF/incompatible.s b/lld/test/ELF/incompatible.s index 82055b7a104..ce84606ad7e 100644 --- a/lld/test/ELF/incompatible.s +++ b/lld/test/ELF/incompatible.s @@ -50,7 +50,7 @@ // RUN: llvm-ar rc %t.a %ta.o // RUN: llvm-mc -filetype=obj -triple=i686-linux %s -o %tb.o // RUN: not ld.lld %t.a %tb.o 2>&1 | FileCheck --check-prefix=ARCHIVE %s -// ARCHIVE: a.o is incompatible with {{.*}}b.o +// ARCHIVE: .a({{.*}}a.o) is incompatible with {{.*}}b.o .global _start _start: .data |

