[compiler-rt] Use .globl for FreeBSD/NetBSD interceptor wrappers
authorJessica Clarke <jrtc27@jrtc27.com>
Tue, 22 Aug 2023 22:38:24 +0000 (23:38 +0100)
committerTobias Hieta <tobias@hieta.se>
Fri, 25 Aug 2023 07:27:09 +0000 (09:27 +0200)
commitc6d6417a0b7cd3a855ae8dcc6dd1111e1759dd2a
tree8c198f6f13279c936f4c16c6659c41443cb2de40
parent5bd2c0c745d4cec0efa15827d80cfb33e453d325
[compiler-rt] Use .globl for FreeBSD/NetBSD interceptor wrappers

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

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D158552

(cherry picked from commit 7e1afab1b1821550c5f8d0d6a50636236fa02e2c)
compiler-rt/lib/interception/interception.h