This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Support common symbols in bitcode (but differently from ld64)
ClosedPublic

Authored by int3 on Jul 28 2021, 9:18 PM.

Details

Summary

ld64 seems to handle common symbols in bitcode rather
bizarrely. They follow entirely different precedence rules from their
non-bitcode counterparts. I initially tried to emulate ld64 in D106597,
but I'm not sure the extra complexity is worth it, especially given that
common symbols are not, well, very common.

This diff accords common bitcode symbols the same precedence as regular
common symbols, just as we treat all other pairs of bitcode and
non-bitcode symbol types. The tests document ld64's behavior in detail,
just in case we want to revisit this.

Diff Detail

Event Timeline

int3 created this revision.Jul 28 2021, 9:18 PM
Herald added a project: Restricted Project. · View Herald Transcript
int3 requested review of this revision.Jul 28 2021, 9:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2021, 9:18 PM
thakis accepted this revision.Jul 29 2021, 1:39 AM
thakis added a subscriber: lgrey.
thakis added a subscriber: thakis.

Makes sense to me. Nice tests!

This revision is now accepted and ready to land.Jul 29 2021, 1:40 AM