This is an archive of the discontinued LLVM Phabricator instance.

[lld/mac] Add --version flag
ClosedPublic

Authored by thakis on Dec 17 2020, 1:31 PM.

Details

Reviewers
int3
Group Reviewers
Restricted Project
Commits
rG77fb45e59e49: [lld/mac] Add --version flag
Summary

It's an extension to ld64, but all the other ports have it, and
someone asked for it in PR43721.

While here, change the COFF help text to match the other ports.

Diff Detail

Event Timeline

thakis created this revision.Dec 17 2020, 1:31 PM
thakis requested review of this revision.Dec 17 2020, 1:31 PM
int3 added a subscriber: int3.Dec 17 2020, 2:00 PM
int3 added inline comments.
lld/MachO/Driver.cpp
758–759

I assume that -- unlike for -v -- we're intentionally not printing out the library/framework search paths for --version... could we update the help text to indicate how -v differs? Also, how about handling OPT_version here, next to OPT_v, just to co-locate similar logic?

lld/MachO/Options.td
512–514

I think it'd make sense to put the flag here under grp_rare

thakis marked an inline comment as done.Dec 22 2020, 9:06 AM

Thanks!

lld/MachO/Driver.cpp
758–759

The other ports have --version up top, before doing any other flag pcoessing. -v has to do flag processing to get the search paths, but --version doesn't, so I'd prefer to keep it up there. Updated the help text for -v.

lld/MachO/Options.td
512–514

Currently all the non-ld64 flags are up top under the Flags that lld/MachO understands but ld64 doesn't comment. Want to to add Group<grp_rare> up there?

thakis updated this revision to Diff 313364.Dec 22 2020, 9:07 AM
thakis marked an inline comment as done.

tweak -v help text

int3 accepted this revision.Dec 22 2020, 6:37 PM
int3 added inline comments.
lld/MachO/Driver.cpp
758–759

fair enough

lld/MachO/Options.td
512–514

hmm I guess we can leave it as-is. maybe we should make a group specifically for lld-specific options?

This revision is now accepted and ready to land.Dec 22 2020, 6:37 PM

Thanks!

lld/MachO/Options.td
512–514

I think that's a good idea.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2020, 7:06 PM
rupprecht added inline comments.
lld/test/MachO/driver.test
2

FYI, this test is overly specific; be89d7460b63508a6a277050395c14a4fa74b031 to fix this.

For comparison, the --version check from lld/test/ELF/driver.test:

# RUN: ld.lld --version 2>&1 | FileCheck -check-prefix=VERSION %s
# RUN: ld.lld -v 2>&1 | FileCheck -check-prefix=VERSION %s
# RUN: not ld.lld -v xyz 2>&1 | FileCheck -check-prefix=VERSION %s
# VERSION: LLD {{.*}} (compatible with GNU linkers)