This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Demote !isUsedInRegularObj lazy symbol
ClosedPublic

Authored by MaskRay on Oct 7 2021, 4:04 PM.

Details

Summary

I think D79300 has fixed the D51892 (__i686.get_pc_thunk.bx) issue, so
we can bring back rL330869.
D79300 says would error undefined symbol instead of the more relevant discarded section
but it doesn't reproduce now.

This avoids a quirk in isUndefWeak().

Diff Detail

Event Timeline

MaskRay created this revision.Oct 7 2021, 4:04 PM
MaskRay requested review of this revision.Oct 7 2021, 4:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 7 2021, 4:04 PM

WIll take a look in more detail next week. IIUC so far, we have a quirk in isUndefWeak because we don't, currently, demote lazy symbols that weren't resolved, due to a problem that we now think is resolved. At a glance it sounds reasonable to me, just need to understand what the original problem was and how D79300 fixes it.

peter.smith accepted this revision.Oct 11 2021, 9:21 AM

LGTM. Following this through I can't think of a test case that we can write as if all is well it should error out before we get to the problem case.

lld/ELF/SyntheticSections.cpp
3165

IIUC we could write assert(!s.sym->isLazy()); here. Not sure whether it would be worth doing it in the long term as it will look somewhat arbitrary. Maybe worth a test run with it in just to see if it hits anything unexpected.

This revision is now accepted and ready to land.Oct 11 2021, 9:21 AM
MaskRay updated this revision to Diff 378707.Oct 11 2021, 9:45 AM
MaskRay marked an inline comment as done.

add an assert

Thanks for the review!

This revision was landed with ongoing or failed builds.Oct 11 2021, 9:46 AM
This revision was automatically updated to reflect the committed changes.