This is an archive of the discontinued LLVM Phabricator instance.

[lld/mac] Abort link immediately on invalid -undefined argument
ClosedPublic

Authored by thakis on Dec 7 2022, 10:50 AM.

Details

Summary

I tried -undefined suppress without -flat_namespace.
lld printed '-undefined suppress' only valid with '-flat_namespace'
followed by many many screenfuls of error messages about undefined
symbols, making the original diag hard to see.

This is probably the common case when using -undefined, so let's
just abort the link immediately when there's an invalid -undefined
arg.

Diff Detail

Event Timeline

thakis created this revision.Dec 7 2022, 10:50 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 7 2022, 10:50 AM
thakis requested review of this revision.Dec 7 2022, 10:50 AM
thakis updated this revision to Diff 480980.Dec 7 2022, 10:51 AM
int3 accepted this revision.Dec 7 2022, 1:22 PM
int3 added a subscriber: int3.
int3 added inline comments.
lld/MachO/Driver.cpp
1611–1612

how about changing the error() call in getUndefinedSymbolTreatment to fatal() instead? That way the motivation for the early exit is clearer + we won't accidentally apply this early exit to other error messages in the future

This revision is now accepted and ready to land.Dec 7 2022, 1:22 PM
thakis added inline comments.Dec 8 2022, 5:30 AM
lld/MachO/Driver.cpp
1611–1612

That's a good idea, thanks. Done.

It does have the effect that -undefined bogus with -fatal_warnings no longer aborts early, while it did previously. That's probably fine.

This revision was landed with ongoing or failed builds.Dec 8 2022, 5:31 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2022, 5:31 AM