diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2014-04-20 15:20:31 -0700 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2014-04-22 16:17:39 -0700 |
commit | d62f28ff5cd41632a14e8ba6e7d148a8c02b491b (patch) | |
tree | 123b808e8e8d98de753d378ef6888c8c7475c852 /gcc-4.9/libiberty/xmalloc.c | |
parent | 256fd727f69b343ab30054fc3f7d3f96debd0068 (diff) | |
download | toolchain_gcc-d62f28ff5cd41632a14e8ba6e7d148a8c02b491b.tar.gz toolchain_gcc-d62f28ff5cd41632a14e8ba6e7d148a8c02b491b.tar.bz2 toolchain_gcc-d62f28ff5cd41632a14e8ba6e7d148a8c02b491b.zip |
[4.9] Fix darwin gcc fails with -flto
Since since 4.9 "-flto" is the default, but with it error reads:
.../ld: error: .../libexec/gcc/arm-linux-androideabi/4.9/liblto_plugin.so
Symbol not found: _environ
Replace "environ" with "*_NSGetEnviron()"
Change-Id: I7f76f938f5b492458a8324a7b68ae42c0c688db6
Diffstat (limited to 'gcc-4.9/libiberty/xmalloc.c')
-rw-r--r-- | gcc-4.9/libiberty/xmalloc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc-4.9/libiberty/xmalloc.c b/gcc-4.9/libiberty/xmalloc.c index 3e97aab56..726ef6427 100644 --- a/gcc-4.9/libiberty/xmalloc.c +++ b/gcc-4.9/libiberty/xmalloc.c @@ -70,6 +70,10 @@ function will be called to print an error message and terminate execution. #include <stddef.h> +#ifdef __APPLE__ +#include <crt_externs.h> +#endif + #if VMS #include <stdlib.h> #include <unixlib.h> @@ -117,7 +121,11 @@ void xmalloc_failed (size_t size) { #ifdef HAVE_SBRK +#ifdef __APPLE__ + #define environ (*_NSGetEnviron()) +#else extern char **environ; +#endif size_t allocated; if (first_break != NULL) |