This is an archive of the discontinued LLVM Phabricator instance.

ELF: clarify error when we don't know the output format
ClosedPublic

Authored by emaste on Sep 8 2016, 8:45 AM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

emaste updated this revision to Diff 70706.Sep 8 2016, 8:45 AM
emaste retitled this revision from to ELF: clarify error when we don't know the output format.
emaste updated this object.
emaste added reviewers: ruiu, rafael.
emaste added a project: lld.
emaste added a subscriber: llvm-commits.
emaste added a comment.Sep 8 2016, 8:56 AM

On second thought "format" is probably not right; the output is always ELF format.

"output target unknown"?
"output emulation unknown"?

emaste updated this revision to Diff 70743.Sep 8 2016, 12:53 PM
emaste added a subscriber: Bigcheese.

update message to one that matches lld --help terminology
-m <value> Set target emulation

davide added a subscriber: davide.Sep 8 2016, 12:57 PM

I find the message slightly more explicative, but I don't have a strong opinion on it.

ruiu accepted this revision.Sep 8 2016, 1:38 PM
ruiu edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 8 2016, 1:38 PM
This revision was automatically updated to reflect the committed changes.