[PATCH] D24357: Report original emulation name in "unknown emulation" error

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 12:35:18 PDT 2016


emaste updated this revision to Diff 70739.
emaste added a comment.

Update an existing "unknown emulation" test to verify this change


https://reviews.llvm.org/D24357

Files:
  ELF/Driver.cpp
  test/ELF/basic.s

Index: test/ELF/basic.s
===================================================================
--- test/ELF/basic.s
+++ test/ELF/basic.s
@@ -223,8 +223,8 @@
 # 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
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -54,7 +54,8 @@
 }
 
 // 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);
 
@@ -77,9 +78,9 @@
 
   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;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24357.70739.patch
Type: text/x-patch
Size: 1479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160908/c4b92f09/attachment.bin>


More information about the llvm-commits mailing list