This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Fix interaction between --unresolved-symbols= and --[no-]allow-shlib-undefined
ClosedPublic

Authored by MaskRay on Nov 15 2020, 2:45 PM.

Details

Summary

As mentioned in https://reviews.llvm.org/D67479#1667256 ,

  • --[no-]allow-shlib-undefined control the diagnostic for an unresolved symbol in a shared object
  • -z defs/-z undefs control the diagnostic for an unresolved symbol in a regular object file
  • --unresolved-symbols= controls both bits.

In addition, make --warn-unresolved-symbols affect --no-allow-shlib-undefined.

This patch makes the behavior match GNU ld.

Diff Detail

Event Timeline

MaskRay created this revision.Nov 15 2020, 2:45 PM
MaskRay requested review of this revision.Nov 15 2020, 2:45 PM
psmith accepted this revision.Nov 17 2020, 2:57 AM

LGTM, with one suggestion of a name change. I've checked the GNU ld behaviour against the green test changes and LLD matches.

lld/ELF/Driver.cpp
587

Perhaps call this setUnresolvedSymbolPolicy as it isn't returning anything and is modifying config as a side effect.

This revision is now accepted and ready to land.Nov 17 2020, 2:57 AM
MaskRay updated this revision to Diff 305870.Nov 17 2020, 12:05 PM
MaskRay marked an inline comment as done.

Rename to setUnresolvedSymbolPolicy

MaskRay updated this revision to Diff 305877.Nov 17 2020, 12:18 PM

Fix test (%t6 does not exist)

MaskRay edited the summary of this revision. (Show Details)Nov 17 2020, 12:20 PM
This revision was landed with ongoing or failed builds.Nov 17 2020, 12:21 PM
This revision was automatically updated to reflect the committed changes.