This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF] Warn on invalid local symbols
AbandonedPublic

Authored by thevinster on Jul 21 2023, 12:57 PM.

Details

Reviewers
MaskRay
smeenai
Summary

Some of our apps are failing to link properly with third-party libraries
because this warning has been converted to an error. In principle, we
shouldn't allow this sort of behavior, but I don't see any reasons for
error-ing since it hasn't caused any real issues for us in the past. For
those who wish to keep it as an error, users may provide -fatal-warnings
to keep the existing behavior.

Diff Detail

Event Timeline

thevinster created this revision.Jul 21 2023, 12:57 PM
Herald added a project: Restricted Project. · View Herald Transcript
thevinster published this revision for review.Jul 21 2023, 1:05 PM
thevinster edited the summary of this revision. (Show Details)
thevinster added a reviewer: smeenai.
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 1:06 PM

@MaskRay This is effectively a revert of https://github.com/llvm/llvm-project/commit/3ac94280245415be66cb1b603367c5f4f6d498e7 (but keeping the message intact). Do you have any suggestions how to get around this specific issue?

MaskRay added a comment.EditedJul 21 2023, 1:32 PM

This is shared object parsing and the performance is less important. If it is important, it may be attempting to remove this error check to have less code in the hot path and just assume that all non-local symbols are not STB_LOCAL. Before we do that, we probably want this to be an error for sufficiently long time.

I wonder whether you can consider binary patching the broken shared objects. I have done similar things for my employer (for symbol versioning, not for this STB_LOCAL instance) as well..
If binary patching doesn't look great, use --noinhibit-exec.

I wonder whether you can consider binary patching the broken shared objects. I have done similar things for my employer (for symbol versioning, not for this STB_LOCAL instance) as well..
If binary patching doesn't look great, use --noinhibit-exec.

Patching the binary is something we're probably going to try and pursue, but I wanted to get your thoughts first whether you feel strongly against switching this back to a warning. Using --noinhibit-exec relaxes other errors as well and would prefer not to do that to avoid more broken shared objects from creeping. So far, it's just this specific message that I've seen so far.

MaskRay added a comment.EditedJul 21 2023, 2:42 PM

I wonder whether you can consider binary patching the broken shared objects. I have done similar things for my employer (for symbol versioning, not for this STB_LOCAL instance) as well..
If binary patching doesn't look great, use --noinhibit-exec.

Patching the binary is something we're probably going to try and pursue, but I wanted to get your thoughts first whether you feel strongly against switching this back to a warning. Using --noinhibit-exec relaxes other errors as well and would prefer not to do that to avoid more broken shared objects from creeping. So far, it's just this specific message that I've seen so far.

errorOrWarn for this instance seems to be better, for (a) the reason I stated in a previous comment, and (b) to match the errorOrWarn binding check ObjFile<EDLFT>::postParse (though we may want to remove that diagnostic completely to remove code from a hot patch in the future)...

thevinster abandoned this revision.Jul 21 2023, 2:50 PM