summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Lettner <jlettner@apple.com>2019-07-11 18:26:33 +0000
committerJulian Lettner <jlettner@apple.com>2019-07-11 18:26:33 +0000
commit9d41429ff790590ae28920357c78e21b49fcf2a5 (patch)
tree37573748f2294188436a2625fb4ea7fb42bb8e8f
parent9512c0a1d1966b7c9328ed1460a1787c4a45cbb6 (diff)
downloadbcm5719-llvm-9d41429ff790590ae28920357c78e21b49fcf2a5.tar.gz
bcm5719-llvm-9d41429ff790590ae28920357c78e21b49fcf2a5.zip
[TSan] Move DECLARE_REAL macro outside of namespace
This should fix the "undefined reference to tsan::interception::real_setjmp" linker errors. llvm-svn: 365806
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc
index 8db6635b141..5d9284c5250 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc
@@ -72,9 +72,21 @@ __tsan::uptr InitializeGuardPtr() __attribute__((visibility("hidden")));
extern "C" __tsan::uptr _tsan_pointer_chk_guard;
#endif
+#if SANITIZER_LINUX && defined(__aarch64__) && !SANITIZER_GO
+# define INIT_LONGJMP_XOR_KEY 1
+#else
+# define INIT_LONGJMP_XOR_KEY 0
+#endif
+
+#if INIT_LONGJMP_XOR_KEY
+#include "interception/interception.h"
+// Must be declared outside of other namespaces.
+DECLARE_REAL(int, _setjmp, void *env)
+#endif
+
namespace __tsan {
-#if SANITIZER_LINUX && defined(__aarch64__) && !SANITIZER_GO
+#if INIT_LONGJMP_XOR_KEY
static void InitializeLongjmpXorKey();
static uptr longjmp_xor_key;
#endif
@@ -415,9 +427,7 @@ uptr ExtractLongJmpSp(uptr *env) {
return UnmangleLongJmpSp(mangled_sp);
}
-#if SANITIZER_LINUX && defined(__aarch64__)
-#include "interception/interception.h"
-DECLARE_REAL(int, _setjmp, void* env)
+#if INIT_LONGJMP_XOR_KEY
// GLIBC mangles the function pointers in jmp_buf (used in {set,long}*jmp
// functions) by XORing them with a random key. For AArch64 it is a global
// variable rather than a TCB one (as for x86_64/powerpc). We obtain the key by
@@ -425,7 +435,7 @@ DECLARE_REAL(int, _setjmp, void* env)
static void InitializeLongjmpXorKey() {
// 1. Call REAL(setjmp), which stores the mangled SP in env.
jmp_buf env;
- // REAL(_setjmp)(env); // TODO(yln)
+ REAL(_setjmp)(env);
// 2. Retrieve mangled/vanilla SP.
uptr mangled_sp = ((uptr *)&env)[LONG_JMP_SP_ENV_SLOT];
OpenPOWER on IntegriCloud