This is an archive of the discontinued LLVM Phabricator instance.

[lld/mac] Implement -arch_multiple
ClosedPublic

Authored by thakis on Jul 5 2021, 5:56 PM.

Details

Reviewers
int3
gkm
Group Reviewers
Restricted Project
Commits
rG64be5b7d8713: [lld/mac] Implement -arch_multiple
Summary

This is the other flag clang passes when calling clang with two -arch
flags (which means with this, clang -arch x86_64 -arch arm64 -fuse-ld=lld ...
now no longer prints any warnings \o/). Since clang calls the linker several
times in that setup, it's not clear to the user from which invocation the
errors are. The flag's help text is

Specifies that the linker should augment error and warning messages
with the architecture name.

In ld64, the only effect of the flag is that undefined symbols are prefaced
with

Undefined symbols for architecture x86_64:

instead of the usual "Undefined symbols:". So for now, let's add this
only to undefined symbol errors too. That's probably the most common
linker diagnostic.

Another idea would be to prefix errors and warnings with "ld64.lld(x86_64):"
instead of the usual "ld64.lld:", but I'm not sure if people would
misunderstand that as a comment about the arch of ld itself.
But open to suggestions on what effect this flag should have :) And we
don't have to get it perfect now, we can iterate on it.

Diff Detail

Event Timeline

thakis created this revision.Jul 5 2021, 5:56 PM
Herald added a reviewer: gkm. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
thakis requested review of this revision.Jul 5 2021, 5:56 PM
int3 accepted this revision.Jul 5 2021, 8:51 PM

Another idea would be to prefix errors and warnings with "ld64.lld(x86_64):"

instead of the usual "ld64.lld:", but I'm not sure if people would
misunderstand that as a comment about the arch of ld itself.

I agree, I think the message as-is is clearer :)

This revision is now accepted and ready to land.Jul 5 2021, 8:51 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2021, 9:27 PM