This is an archive of the discontinued LLVM Phabricator instance.

[LLD] [MinGW] Add an option -Xlink for passing options through to lld-link
ClosedPublic

Authored by mstorsjo on Nov 1 2017, 11:24 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.Nov 1 2017, 11:24 PM
ruiu added inline comments.Nov 2 2017, 10:47 AM
MinGW/Options.td
34 ↗(On Diff #121236)

I would prefer we always require = after -Xlink, because -Xlink=-lldmap is easier to read and less confusing than -Xlink -lldmap on command line.

mstorsjo added inline comments.Nov 2 2017, 11:41 AM
MinGW/Options.td
34 ↗(On Diff #121236)

Is there any predecent for such style elsewhere? The -Xfoo -bar style is used by clang (or does that one also support -Xfoo=-bar?), and there's also the -Wl,-bar style used in the clang and gcc drivers for some things. That syntax would be a little messy here though, since you'd already need to use -Wl, to pass options from clang to the mingw linker frontend.

ruiu added inline comments.Nov 2 2017, 11:55 AM
MinGW/Options.td
34 ↗(On Diff #121236)

I don't know of any precedent of the style in compilers, but there might be in some command that takes meta-options. At least it helps me understand a command line if = is mandatory. If you feel strongly, I'm fine without = though.

mstorsjo added inline comments.Nov 2 2017, 2:08 PM
MinGW/Options.td
34 ↗(On Diff #121236)

I don't feel very strongly about it, so let's go with -Xlink=-foo.

mstorsjo updated this revision to Diff 121373.Nov 2 2017, 2:09 PM

Using the form -Xlink=-foo as requested.

ruiu accepted this revision.Nov 2 2017, 2:11 PM

LGTM

MinGW/Options.td
34 ↗(On Diff #121236)

GNU ld manual says that it takes either -foo or --foo except a single letter option or an option starting with 'o' (to avoid conflict with -o). So, you want to use J instead of Joined to accept both -Xlink and --Xlink.

This revision is now accepted and ready to land.Nov 2 2017, 2:11 PM
This revision was automatically updated to reflect the committed changes.