summaryrefslogtreecommitdiff
path: root/libc/private/bionic_macros.h
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2019-08-07 19:06:00 -0700
committerPeter Collingbourne <pcc@google.com>2019-08-15 09:21:34 -0700
commit191ecdc49ba18fc07d62d419fd51cc7dee4190f8 (patch)
treebfd1dc23f8fed1ddeee6b62a81623b32159b6799 /libc/private/bionic_macros.h
parent639ad55176c78bfd70c3786a92a05dd3d2299953 (diff)
Fix a few bionic test failures caused by hwasan global instrumentation.
The call to the load hook needs to be moved before the call to link_image() because the latter calls ifunc resolvers which might access global variables. This fixes a bunch of ifunc tests. The dlfcn.segment_gap test is currently failing. One problem is that the name of the .bss.end_of_gap section changes as a result of global instrumentation. Add some wildcards in so that we match both names. The other problem seems to be the same as b/139089152. It turns out that we need to untag pointers in a few more places. Since we have quite a few of these now it seems worth creating a function for it. Test: bionic-unit-tests Change-Id: I44e2b0904faacdda7cc0c5e844ffc09de01dea2d
Diffstat (limited to 'libc/private/bionic_macros.h')
-rw-r--r--libc/private/bionic_macros.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libc/private/bionic_macros.h b/libc/private/bionic_macros.h
index 4800e3af9..13934e5f6 100644
--- a/libc/private/bionic_macros.h
+++ b/libc/private/bionic_macros.h
@@ -87,3 +87,12 @@ char (&ArraySizeHelper(T (&array)[N]))[N]; // NOLINT(readability/casting)
#else
#define __BIONIC_FALLTHROUGH
#endif
+
+template <typename T>
+static inline T* untag_address(T* p) {
+#if defined(__aarch64__)
+ return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & ((1ULL << 56) - 1));
+#else
+ return p;
+#endif
+}