lib/asan: Attempt to ensure __WORDSIZE gets defined, it is not always set by
Darwin's stdint.h for example.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@145663 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/asan/asan_internal.h b/lib/asan/asan_internal.h
index 16d8e42..89b9e20 100644
--- a/lib/asan/asan_internal.h
+++ b/lib/asan/asan_internal.h
@@ -22,6 +22,16 @@
#include <stdlib.h> // for size_t
#include <unistd.h> // for _exit
+// If __WORDSIZE was undefined by the platform, define it in terms of the
+// compiler built-in __LP64__.
+#ifndef __WORDSIZE
+#if __LP64__
+#define __WORDSIZE 64
+#else
+#define __WORDSIZE 32
+#endif
+#endif
+
#ifdef ANDROID
#include <sys/atomics.h>
#endif