[compiler-rt] db7e8f2 - [compiler-rt] Hardcode uptr/sptr typedefs on Linux Arm (#108105)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 10 17:02:19 PDT 2024
Author: Arthur Eubanks
Date: 2024-09-10T17:02:15-07:00
New Revision: db7e8f2ae81fe10170dc202e45ee8b784e75c74c
URL: https://github.com/llvm/llvm-project/commit/db7e8f2ae81fe10170dc202e45ee8b784e75c74c
DIFF: https://github.com/llvm/llvm-project/commit/db7e8f2ae81fe10170dc202e45ee8b784e75c74c.diff
LOG: [compiler-rt] Hardcode uptr/sptr typedefs on Linux Arm (#108105)
After #106155, Android arm32 asan builds stopped working with missing
definition linker errors. This is due to inconsistent definitions of
`uptr` of either `unsigned long` or `unsigned int` even between TUs in
compiler-rt. This is caused by Linux arm32 headers redefining
`__UINTPTR_TYPE__` (see `arch/arm/include/uapi/asm/types.h` in the Linux
kernel repo), meaning include order/whether or not the Linux header is
included changes compiler-rt symbol mangling.
As a workaround, this hardcodes `uptr`/`sptr` in compiler-rt to
`unsigned int`/`int` on Linux arm32, matching clang/gcc.
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
index f8f03454ea169a..9208b12552ff5c 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -139,8 +139,14 @@
namespace __sanitizer {
#if defined(__UINTPTR_TYPE__)
+# if defined(__arm__) && defined(__linux__)
+// Linux Arm headers redefine __UINTPTR_TYPE__ and disagree with clang/gcc.
+typedef unsigned int uptr;
+typedef int sptr;
+# else
typedef __UINTPTR_TYPE__ uptr;
typedef __INTPTR_TYPE__ sptr;
+# endif
#elif defined(_WIN64)
// 64-bit Windows uses LLP64 data model.
typedef unsigned long long uptr;
More information about the llvm-commits
mailing list