This is an archive of the discontinued LLVM Phabricator instance.

[ELF] --exclude-libs: localize defined libcall symbols referenced by lto.tmp
ClosedPublic

Authored by MaskRay on Jan 7 2021, 6:43 PM.

Details

Summary

Fixes PR48681: after LTO, lto.tmp may reference a libcall symbol not in an IR
symbol table of any bitcode file. If such a symbol is defined in an archive
matched by a --exclude-libs, we don't correctly localize the symbol.

Add another excludeLibs after compileBitcodeFiles to localize such libcall
symbols. Unfortunately we have keep the existing one for D43126.

As I understand it, using VER_NDX_LOCAL is an implementation detail of
--exclude-libs and the symbol ... has undefined version ... error should not
be exempted. Ideally we should error as GNU ld does.

Diff Detail

Event Timeline

MaskRay created this revision.Jan 7 2021, 6:43 PM
MaskRay requested review of this revision.Jan 7 2021, 6:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 7 2021, 6:43 PM
MaskRay updated this revision to Diff 315285.Jan 7 2021, 6:44 PM

Add REQUIRES

MaskRay added inline comments.Jan 7 2021, 6:47 PM
lld/test/ELF/lto/exclude-libs-libcall.ll
3

Forgot to add a comment:

lto.tmp may reference a libcall symbol not in the IR symbol table. If such a symbol is defined in an archive matched by a --exclude-libs, the symbol should be localized.

psmith accepted this revision.Jan 8 2021, 10:33 AM

LGTM, may be worth waiting for any other comments.

I reported the Bionic issue mentioned in D43126 under https://issuetracker.google.com/issues/73020933 . From memory it was possible to work around the failure by providing a symbol versioning script but I wasn't able to convince the maintainer it was worthwhile. May be worth having another try?

This revision is now accepted and ready to land.Jan 8 2021, 10:33 AM
MaskRay added a subscriber: enh.Jan 8 2021, 11:22 AM
This revision was landed with ongoing or failed builds.Jan 11 2021, 9:33 AM
This revision was automatically updated to reflect the committed changes.