Page MenuHomePhabricator

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

Authored by MaskRay on Thu, Jan 7, 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.Thu, Jan 7, 6:43 PM
MaskRay requested review of this revision.Thu, Jan 7, 6:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptThu, Jan 7, 6:43 PM
MaskRay updated this revision to Diff 315285.Thu, Jan 7, 6:44 PM

Add REQUIRES

MaskRay added inline comments.Thu, Jan 7, 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.Fri, Jan 8, 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.Fri, Jan 8, 10:33 AM
MaskRay added a subscriber: enh.Fri, Jan 8, 11:22 AM
This revision was landed with ongoing or failed builds.Mon, Jan 11, 9:33 AM
This revision was automatically updated to reflect the committed changes.