[compiler-rt] cf6d7d5 - Fix "[compiler-rt] Allow 3 simultaneous interceptors on Linux"
Marco Elver via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 9 05:36:40 PDT 2023
Author: Marco Elver
Date: 2023-06-09T14:34:01+02:00
New Revision: cf6d7d5f6df9d9dcaeca78d5f4be735ea74651b0
URL: https://github.com/llvm/llvm-project/commit/cf6d7d5f6df9d9dcaeca78d5f4be735ea74651b0
DIFF: https://github.com/llvm/llvm-project/commit/cf6d7d5f6df9d9dcaeca78d5f4be735ea74651b0.diff
LOG: Fix "[compiler-rt] Allow 3 simultaneous interceptors on Linux"
Build bots have been failing with:
/usr/bin/ld: read-only segment has dynamic relocations
Remove support for interceptor trampoline on s390, and revert new
implementation of __tls_get_offset.
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_asm.h
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_asm.h b/compiler-rt/lib/sanitizer_common/sanitizer_asm.h
index fc96847b5c211..6c1418fc19d79 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_asm.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_asm.h
@@ -66,7 +66,7 @@
# define ASM_SIZE(symbol) .size symbol, .-symbol
# define ASM_SYMBOL(symbol) symbol
# define ASM_SYMBOL_INTERCEPTOR(symbol) symbol
-# if defined(__i386__) || defined(__powerpc__)
+# if defined(__i386__) || defined(__powerpc__) || defined(__s390__)
// For details, see interception.h
# define ASM_WRAPPER_NAME(symbol) __interceptor_##symbol
# define ASM_TRAMPOLINE_ALIAS(symbol, name) \
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
index de307ff4e3061..e01dc4c87ffb8 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -5426,20 +5426,16 @@ extern "C" __attribute__((visibility("hidden"))) uptr __tls_get_addr_hidden(
extern "C" uptr __tls_get_offset(void *arg);
extern "C" uptr TRAMPOLINE(__tls_get_offset)(void *arg);
extern "C" uptr WRAP(__tls_get_offset)(void *arg);
-// Now carefully intercept __tls_get_offset. See DECLARE_WRAPPER for details.
+// Now carefully intercept __tls_get_offset.
asm(
".text\n"
+// The __intercept_ version has to exist, so that gen_dynamic_list.py
+// exports our symbol.
".weak __tls_get_offset\n"
- ".set __tls_get_offset, __interceptor_trampoline___tls_get_offset\n"
- ".global __interceptor_trampoline___tls_get_offset\n"
- ".type __interceptor_trampoline___tls_get_offset, @function\n"
- "__interceptor_trampoline___tls_get_offset:\n"
- "jg __interceptor___tls_get_offset\n"
- ".weak __interceptor___tls_get_offset\n"
- ".set __interceptor___tls_get_offset, ___interceptor___tls_get_offset\n"
- ".global ___interceptor___tls_get_offset\n"
- ".type ___interceptor___tls_get_offset, @function\n"
- "___interceptor___tls_get_offset:\n"
+ ".set __tls_get_offset, __interceptor___tls_get_offset\n"
+ ".global __interceptor___tls_get_offset\n"
+ ".type __interceptor___tls_get_offset, @function\n"
+ "__interceptor___tls_get_offset:\n"
#ifdef __s390x__
"la %r2, 0(%r2,%r12)\n"
"jg __tls_get_addr_hidden\n"
@@ -5450,7 +5446,7 @@ asm(
"b 0(%r4,%r3)\n"
"1: .long __tls_get_addr_hidden - 0b\n"
#endif
- ".size ___interceptor___tls_get_offset, .-___interceptor___tls_get_offset\n"
+ ".size __interceptor___tls_get_offset, .-__interceptor___tls_get_offset\n"
// Assembly wrapper to call REAL(__tls_get_offset)(arg)
".type __tls_get_offset_wrapper, @function\n"
"__tls_get_offset_wrapper:\n"
More information about the llvm-commits
mailing list