[PATCH] D24348: ELF: clarify error when we don't know the output format

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 08:45:25 PDT 2016


emaste created this revision.
emaste added reviewers: ruiu, rafael.
emaste added a subscriber: llvm-commits.
emaste added a project: lld.

lld differs from GNU ld in that it does not have a built-in default output emulation. It is always specified via the -m option or obtained from the object file(s) being linked. In most cases there is at least one ELF object in the link, so the emulation is known.

When using the WIP -b binary support (D24060) with -r to convert a binary file into an ELF object we do not have a known emulation. The error message previously emitted in this case "-m or at least a .o file required" is accurate but does not offer much insight. Add text to the error message indicating why -m or an object file is required.

https://reviews.llvm.org/D24348

Files:
  ELF/Driver.cpp
  test/ELF/no-obj.s

Index: test/ELF/no-obj.s
===================================================================
--- test/ELF/no-obj.s
+++ test/ELF/no-obj.s
@@ -2,7 +2,7 @@
 // RUN: llvm-ar rcs %t.a %t.o
 // RUN: not ld.lld -o %t2 -u _start %t.a 2>&1 | FileCheck %s
 
-// CHECK: -m or at least a .o file required
+// CHECK: output format unknown: -m or at least one .o file required
 
 .global _start
 _start:
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -316,7 +316,7 @@
     link<ELF64BE>(Args);
     return;
   default:
-    error("-m or at least a .o file required");
+    error("output format unknown: -m or at least one .o file required");
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24348.70706.patch
Type: text/x-patch
Size: 722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160908/985fffad/attachment.bin>


More information about the llvm-commits mailing list