This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Inspect -EL & -EB for OUTPUT_FORMAT(default, big, little)
ClosedPublic

Authored by MaskRay on Feb 6 2021, 3:35 PM.

Details

Summary

Choose big if -EB is specified, little if -EL is specified, or default if neither is specified.
The new behavior matches GNU ld.

Fixes: https://github.com/ClangBuiltLinux/linux/issues/1025

Diff Detail

Event Timeline

MaskRay created this revision.Feb 6 2021, 3:35 PM
MaskRay requested review of this revision.Feb 6 2021, 3:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 6 2021, 3:35 PM
MaskRay edited the summary of this revision. (Show Details)Feb 6 2021, 3:35 PM
MaskRay updated this revision to Diff 321969.Feb 6 2021, 3:36 PM

fix test

MaskRay edited the summary of this revision. (Show Details)Feb 6 2021, 3:39 PM
peter.smith accepted this revision.Feb 8 2021, 4:49 AM

LGTM, I've made some small suggestions.

lld/ELF/Config.h
157

eb and el are close in name to the isLE option? Perhaps use something like "optLE" or "leSet" to avoid confusion.

lld/ELF/Options.td
162

Worth adding a simple line of text for the help file? Possibly the man page as well.
ld.bfd says "Link little-endian objects" for EL

lld/ELF/ScriptParser.cpp
436

Worth mentioning what happens if second form is used but no choice of -EB or -EL is made.
"choose big if -EB is specified, little if -EL is specified or default if neither is specified."

https://sourceware.org/binutils/docs/ld/Format-Commands.html

This revision is now accepted and ready to land.Feb 8 2021, 4:49 AM
MaskRay updated this revision to Diff 322156.Feb 8 2021, 10:14 AM
MaskRay marked 3 inline comments as done.
MaskRay edited the summary of this revision. (Show Details)

comments

MaskRay updated this revision to Diff 322160.Feb 8 2021, 10:27 AM

variant->format

MaskRay updated this revision to Diff 322161.Feb 8 2021, 10:29 AM

better diagnostic

This revision was landed with ongoing or failed builds.Feb 8 2021, 10:35 AM
This revision was automatically updated to reflect the committed changes.