[lld] r280983 - ELF: Report original emulation name in "unknown emulation" error
Ed Maste via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 8 12:36:22 PDT 2016
Author: emaste
Date: Thu Sep 8 14:36:22 2016
New Revision: 280983
URL: http://llvm.org/viewvc/llvm-project?rev=280983&view=rev
Log:
ELF: Report original emulation name in "unknown emulation" error
A trailing _fbsd is stripped from emulation names, but if the result was
still not a valid emulation the error was somewhat confusing.
For example,
% ld.lld -m elf_amd64_fbsd
unknown emulation: elf_amd64
Use the original emulation name in error messages.
Differential Revision: https://reviews.llvm.org/D24357
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/test/ELF/basic.s
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=280983&r1=280982&r2=280983&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Thu Sep 8 14:36:22 2016
@@ -54,7 +54,8 @@ bool elf::link(ArrayRef<const char *> Ar
}
// Parses a linker -m option.
-static std::pair<ELFKind, uint16_t> parseEmulation(StringRef S) {
+static std::pair<ELFKind, uint16_t> parseEmulation(StringRef Emul) {
+ StringRef S = Emul;
if (S.endswith("_fbsd"))
S = S.drop_back(5);
@@ -78,9 +79,9 @@ static std::pair<ELFKind, uint16_t> pars
if (Ret.first == ELFNoneKind) {
if (S == "i386pe" || S == "i386pep" || S == "thumb2pe")
- error("Windows targets are not supported on the ELF frontend: " + S);
+ error("Windows targets are not supported on the ELF frontend: " + Emul);
else
- error("unknown emulation: " + S);
+ error("unknown emulation: " + Emul);
}
return Ret;
}
Modified: lld/trunk/test/ELF/basic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic.s?rev=280983&r1=280982&r2=280983&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic.s (original)
+++ lld/trunk/test/ELF/basic.s Thu Sep 8 14:36:22 2016
@@ -223,8 +223,8 @@ _start:
# RUN: not ld.lld %t %t -o %t2 2>&1 | FileCheck --check-prefix=DUP %s
# DUP: duplicate symbol: _start in {{.*}} and {{.*}}
-# RUN: not ld.lld %t -o %t -m wrong_emul 2>&1 | FileCheck --check-prefix=UNKNOWN_EMUL %s
-# UNKNOWN_EMUL: unknown emulation: wrong_emul
+# RUN: not ld.lld %t -o %t -m wrong_emul_fbsd 2>&1 | FileCheck --check-prefix=UNKNOWN_EMUL %s
+# UNKNOWN_EMUL: unknown emulation: wrong_emul_fbsd
# RUN: not ld.lld %t --lto-jobs=0 2>&1 | FileCheck --check-prefix=NOTHREADS %s
# NOTHREADS: number of threads must be > 0
More information about the llvm-commits
mailing list