summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-04-27 00:33:38 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-04-27 00:33:38 (GMT)
commitb529c249214096a6e08a50399692d124c26dba29 (patch)
treeff117cd9b5cef944ec613a3ccdb8ee365babb650 /Objects
parent3a34a72e781de52d156f0316484bc712e2be4643 (diff)
downloadcpython-b529c249214096a6e08a50399692d124c26dba29.zip
cpython-b529c249214096a6e08a50399692d124c26dba29.tar.gz
cpython-b529c249214096a6e08a50399692d124c26dba29.tar.bz2
allow 2.7 to be built with asan (closes #24061)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/obmalloc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index 1434206..85eee61 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -1,5 +1,23 @@
#include "Python.h"
+#if defined(__has_feature) /* Clang */
+ #if __has_feature(address_sanitizer) /* is ASAN enabled? */
+ #define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS \
+ __attribute__((no_address_safety_analysis)) \
+ __attribute__ ((noinline))
+ #else
+ #define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
+ #endif
+#else
+ #if defined(__SANITIZE_ADDRESS__) /* GCC 4.8.x, is ASAN enabled? */
+ #define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS \
+ __attribute__((no_address_safety_analysis)) \
+ __attribute__ ((noinline))
+ #else
+ #define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
+ #endif
+#endif
+
#ifdef WITH_PYMALLOC
#ifdef HAVE_MMAP
@@ -971,6 +989,7 @@ redirect:
/* free */
#undef PyObject_Free
+ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
void
PyObject_Free(void *p)
{
@@ -1201,6 +1220,7 @@ redirect:
*/
#undef PyObject_Realloc
+ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
void *
PyObject_Realloc(void *p, size_t nbytes)
{