From e26b1a0b2a07bf41507f2e1c30f0334812ba8659 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 21 Nov 2018 20:19:06 -0500 Subject: [PATCH] Add debug heap support on AIX with IBM XLC --- GNUmakefile | 11 ++++++++++- stdcpp.h | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 54c14af9..d1842d41 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -1064,7 +1064,16 @@ ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),) endif # CXXFLAGS endif # HAS_NEWLIB endif # USING_GLIBCXX -endif # GNU Debug build + + ifeq ($(XLC_COMPILER),1) + TPROG = TestPrograms/test_cxx.cxx + TOPT = -qheapdebug -qro + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + ifeq ($(strip $(HAVE_OPT)),0) + CXXFLAGS += -qheapdebug -qro + endif # CXXFLAGS + endif # XLC_COMPILER +endif # Debug build # Dead code stripping. Issue 'make lean'. ifeq ($(findstring lean,$(MAKECMDGOALS)),lean) diff --git a/stdcpp.h b/stdcpp.h index 80da2fd7..838d1766 100644 --- a/stdcpp.h +++ b/stdcpp.h @@ -32,6 +32,14 @@ namespace std { } #endif +// workaround needed for IBM XLC and debug heaps on AIX +#if defined(_AIX) && (defined(__xlc__) || defined(__xlC__) || defined(__ibmxl__)) +namespace std { + using ::_debug_memset; + using ::_debug_memcpy; +} +#endif + // make_unchecked_array_iterator #if _MSC_VER >= 1600 #include @@ -81,4 +89,4 @@ namespace std { using std::log; #endif -#endif +#endif // CRYPTOPP_STDCPP_H