On 06/09/2016 11:25 AM, David Edelsohn wrote:
AIX has added variants of malloc, realloc, calloc and valloc with
greater compatibility with Linux semantics, especially for NULL
addresses. The variants are declared in stdlib.h and use #define to
override the normal definition if _LINUX_SOURCE_COMPAT is defined,
e.g.,
#define malloc __linux_malloc
#define calloc __linux_calloc
#define realloc __linux_realloc
#define valloc __linux_valloc
libstdc++-v3 cstdlib specifically undefines a number of stdlib.h macros, e.g.,
// Get rid of those macros defined in <stdlib.h> in lieu of real functions.
...
#undef malloc
#undef realloc
C++ applications on AIX, especially users of BOOST that include
cstdlib, encounter unexpected behavior when the definition of malloc
changes from the expected / requested version.
The following patch updates fixincludes to correct the AIX stdlib.h
header by converting the #define to GCC asm aliases. I created a
separate fix for each definition because the order is not guaranteed.
Bootstrapped on powerpc-ibm-aix7.1.0.0. This fixes a recent node.js
build failure on AIX due to additional dependence on BOOST.
Okay for trunk, GCC 6 and GCC 5?
Thanks, David
* inclhack.def (aix_stdlib_malloc): New fix.
(aix_stdlib_realloc): New fix.
(aix_stdlib_calloc): New fix.
(aix_stdlib_valloc): New fix.
* fixincl.x: Regenerate.
* test/base/stdlib.h [AIX_STDLIB_MALLOC]: New test.
[AIX_STDLIB_REALLOC]: New test.
[AIX_STDLIB_CALLOC]: New test.
[AIX_STDLIB_VALLOC]: New test.
Wow, fixincludes.... I'm not even sure if Bruce is around anymore...
GIven these are conditional on mach= *-*-aix*, I think you can
self-approve them.
jeff