Page MenuHomePhabricator

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

Authored by MaskRay on Sun, Nov 15, 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.Sun, Nov 15, 2:45 PM
MaskRay requested review of this revision.Sun, Nov 15, 2:45 PM
psmith accepted this revision.Tue, Nov 17, 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.Tue, Nov 17, 2:57 AM
MaskRay updated this revision to Diff 305870.Tue, Nov 17, 12:05 PM
MaskRay marked an inline comment as done.

Rename to setUnresolvedSymbolPolicy

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

Fix test (%t6 does not exist)

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