This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Use .globl for FreeBSD/NetBSD interceptor wrappers
ClosedPublic

Authored by jrtc27 on Aug 22 2023, 2:10 PM.

Details

Summary

On FreeBSD and NetBSD we don't use .weak due to differing semantics.
Currently we end up using no directive, which gives a local symbol,
whereas the closer thing to a weak symbol would be a global one. In
particular, both GNU and LLVM toolchains cannot handle a GOT-indirect
reference to a local symbol at a non-zero offset within a section on
AArch64 (see https://github.com/ARM-software/abi-aa/issues/217), and so
interceptors do not work on FreeBSD/arm64, failing to link with LLD.
Switching to .globl both works around this bug and more closely aligns
such non-weak platforms with weak ones.

Fixes https://github.com/llvm/llvm-project/issues/63418

Diff Detail

Event Timeline

jrtc27 created this revision.Aug 22 2023, 2:10 PM
jrtc27 requested review of this revision.Aug 22 2023, 2:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 22 2023, 2:10 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
MaskRay accepted this revision.Aug 22 2023, 3:17 PM
This revision is now accepted and ready to land.Aug 22 2023, 3:17 PM
This revision was landed with ongoing or failed builds.Aug 22 2023, 3:38 PM
This revision was automatically updated to reflect the committed changes.