diff options
Diffstat (limited to 'src/lisp.h')
-rw-r--r-- | src/lisp.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lisp.h b/src/lisp.h index 0f70f60d75c..0dcf803e124 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -22,7 +22,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <alloca.h> #include <setjmp.h> -#include <stdalign.h> #include <stdarg.h> #include <stddef.h> #include <string.h> @@ -5296,6 +5295,26 @@ __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 USE_SANITIZER_UNALIGNED_LOAD +# include <sanitizer/common_interface_defs.h> +# if (SIZE_MAX == UINT64_MAX) +# define UNALIGNED_LOAD_SIZE(a, i) \ + (size_t) __sanitizer_unaligned_load64 ((void *) ((a) + (i))) +# elif (SIZE_MAX == UINT32_MAX) +# define UNALIGNED_LOAD_SIZE(a, i) \ + (size_t) __sanitizer_unaligned_load32 ((void *) ((a) + (i))) +# else +# define UNALIGNED_LOAD_SIZE(a, i) *((a) + (i)) +# endif +#else +# define UNALIGNED_LOAD_SIZE(a, i) *((a) + (i)) +#endif + extern void xputenv (const char *); extern char *egetenv_internal (const char *, ptrdiff_t); |