summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVibhav Pant <vibhavp@gmail.com>2022-12-18 20:25:55 +0530
committerVibhav Pant <vibhavp@gmail.com>2022-12-18 20:25:55 +0530
commit8043ba186dc9d296624d975715938bc4341cc94d (patch)
treecb122e8fc1173f6e94fb87056b14affb33c3fb22
parentb9495c3713789df6af775ae789dbcd2145532f01 (diff)
downloademacs-feature/asan-gc-poisoning.tar.gz
Avoid build failure when building without -fsanitize=address.feature/asan-gc-poisoning
* src/lisp.h (UNALIGNED_LOAD_SIZE): Only use the sanitizer version of the macro when USE_SANITIZER_UNALIGNED_LOAD is defined, avoiding link errors when building without -fsanitize=address.
-rw-r--r--src/lisp.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lisp.h b/src/lisp.h
index f466d4b0da5..be511a0eb9c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -5296,8 +5296,12 @@ __lsan_ignore_object (void const *p)
}
#endif
+/* If built with USE_SANITIZER_UNALIGNED_LOAD defined, use compiler
+ provided ASan functions to perform unaligned loads, allowing ASan
+ to catch bugs which it might otherwise miss. */
#if defined HAVE_SANITIZER_COMMON_INTERFACE_DEFS_H \
- && defined ADDRESS_SANITIZER
+ && defined ADDRESS_SANITIZER \
+ && defined USE_SANITIZER_UNALIGNED_LOAD
# include <sanitizer/common_interface_defs.h>
# if (SIZE_MAX == UINT64_MAX)
# define UNALIGNED_LOAD_SIZE(a, i) \