This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objcopy] Add -F|--target compatibility
ClosedPublic

Authored by rupprecht on Oct 9 2018, 10:24 AM.

Details

Summary

This change adds support for the GNU --target flag, which sets both --input-target and --output-target.

GNU objcopy doesn't do any checking for whether both --target and --{input,output}-target are used, and so it allows both, e.g. "--target A --output-target B" is equivalent to "--input-target A --output-target B" since the later command line flag would override earlier ones. This may be error prone, so I chose to implement it as an error if both are used. I'm not sure if anyone is actually using both.

Diff Detail

Repository
rL LLVM

Event Timeline

rupprecht created this revision.Oct 9 2018, 10:24 AM
jakehehrlich accepted this revision.Oct 9 2018, 12:17 PM

I think this is probably fine. I think having the error is better than not having it. I'm just concerned someone somewhere is using GNU objcopy in the way mentioned in the error. I'm fine treating this as an error and only switching behavior if and when someone hits an issue.

So LGTM. I'd wait on one more person to cast their vote on this situation.

This revision is now accepted and ready to land.Oct 9 2018, 12:17 PM
alexander-shaposhnikov accepted this revision.EditedOct 11 2018, 4:40 PM

thanks, sorry for causing you to rebase

This revision was automatically updated to reflect the committed changes.
jhenderson added inline comments.Oct 15 2018, 11:48 AM
llvm/trunk/test/tools/llvm-objcopy/input-output-target.test
14

What's this TODO about?

rupprecht added inline comments.Oct 15 2018, 1:09 PM
llvm/trunk/test/tools/llvm-objcopy/input-output-target.test
14

D'oh, forgot to remove the TODO after I implemented the test case
Will remove this in a separate commit, thanks for noticing this!