[Python-checkins] cpython (2.7): allow 2.7 to be built with asan (closes #24061)
benjamin.peterson
python-checkins at python.org
Mon Apr 27 02:35:02 CEST 2015
https://hg.python.org/cpython/rev/4234b0dd2a54
changeset: 95816:4234b0dd2a54
branch: 2.7
parent: 95814:192f9efe4a38
user: Benjamin Peterson <benjamin at python.org>
date: Sun Apr 26 20:33:38 2015 -0400
summary:
allow 2.7 to be built with asan (closes #24061)
files:
Objects/obmalloc.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
--- 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 @@
/* free */
#undef PyObject_Free
+ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
void
PyObject_Free(void *p)
{
@@ -1201,6 +1220,7 @@
*/
#undef PyObject_Realloc
+ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
void *
PyObject_Realloc(void *p, size_t nbytes)
{
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list