This is an archive of the discontinued LLVM Phabricator instance.

Add the /v option which prints out the LLD version string.
ClosedPublic

Authored by ruiu on Oct 16 2017, 1:39 PM.

Details

Summary

Add the /v option which prints out the LLD version string.

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu created this revision.Oct 16 2017, 1:39 PM
hans added a subscriber: hans.Oct 16 2017, 1:44 PM

Would it be easy to print the version number as part of /? instead? Maybe that's safer.

It's a little bit confusing that for gcc/clang, -v means verbose, for ld it means version, we can't use /version for lld-link because for link.exe that means something else..

ruiu updated this revision to Diff 119207.Oct 16 2017, 1:51 PM
  • Removed /v
  • Added the version string to help message
hans added a subscriber: thakis.Oct 16 2017, 1:57 PM

Thanks!

Nico, this addresses your needs, right?

lld/test/COFF/help.test
3 ↗(On Diff #119207)

Maybe add a regex to check that it prints something that looks like a version?

FWIW, I've got code elsewhere that detects lld-link, that looks like this:

https://git.libav.org/?p=libav.git;a=blob;f=configure;h=e45b3201fc9a92acd7ff71778b67d227e4178297;hb=1c5f264787b1c1cf67e5e71d08b8d8b03b0c8248#l3380

elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then

and then for getting the actual version from that linker:

_ident=$($_cc -flavor gnu --version 2>/dev/null)

Once this goes in, at least the first test needs to be adjusted, in case I want the code to work both with LLD <= 5.0 and >= 6.0.

This would work for me, but it sounds like it'd break mstorsjo :-( Maybe lld-link and clang-cl should both just have a --version. That won't clash, does what it says, and won't break existing code.

ruiu added a comment.Oct 16 2017, 2:59 PM

Are you suggesting we implement the Unix-style, double-hyphen --version to lld-link? It would work, but it seem a bit strange to me, as all the other options starts with "/".

Yes, that's what I meant. clang-cl also has a bunch of Unix style flags. I agree it's a bit strange, but it'd be llvm-consistent.

ruiu updated this revision to Diff 119802.Oct 22 2017, 5:03 PM

Instead of including version information to the --help message, add the --version option.

thakis accepted this revision.Oct 23 2017, 7:41 AM

Thanks!

This revision is now accepted and ready to land.Oct 23 2017, 7:41 AM
This revision was automatically updated to reflect the committed changes.