diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2014-07-31 15:30:24 +0800 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2014-07-31 15:33:03 +0800 |
commit | c2bbbc54a4871d875e0f034aad73df85679206a2 (patch) | |
tree | d41f02f24017040d719de203b1429228369ea9fb /gcc-4.8 | |
parent | 38a8aecfb882072900434499696b5c32a2274515 (diff) | |
download | toolchain_gcc-c2bbbc54a4871d875e0f034aad73df85679206a2.tar.gz toolchain_gcc-c2bbbc54a4871d875e0f034aad73df85679206a2.tar.bz2 toolchain_gcc-c2bbbc54a4871d875e0f034aad73df85679206a2.zip |
[4.8] Fix darwin gcc fails with gcc-ar which calls lto plugin
See d62f28ff5cd41632a14e8ba6e7d148a8c02b491b for same fix in 4.9
but for different reason.
Since ndk-build use *-gcc-ar inplace of *-ar lto plugin is called with error reads:
.../ld: error: .../libexec/gcc/arm-linux-androideabi/4.9/liblto_plugin.so
Symbol not found: _environ
The fix is to replace "environ" with "*_NSGetEnviron()"
Change-Id: I6aad80b5a9a6c735c36b840878970d83e25974d1
Diffstat (limited to 'gcc-4.8')
-rw-r--r-- | gcc-4.8/libiberty/pex-unix.c | 8 | ||||
-rw-r--r-- | gcc-4.8/libiberty/xmalloc.c | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc-4.8/libiberty/pex-unix.c b/gcc-4.8/libiberty/pex-unix.c index addf8ee23..1b9fa113b 100644 --- a/gcc-4.8/libiberty/pex-unix.c +++ b/gcc-4.8/libiberty/pex-unix.c @@ -59,6 +59,10 @@ extern int errno; #include <process.h> #endif +#ifdef __APPLE__ +#include <crt_externs.h> +#endif + #ifdef vfork /* Autoconf may define this to fork for us. */ # define VFORK_STRING "fork" #else @@ -389,7 +393,11 @@ pex_child_error (struct pex_obj *obj, const char *executable, /* Execute a child. */ +#ifdef __APPLE__ +#define environ (*_NSGetEnviron()) +#else extern char **environ; +#endif #if defined(HAVE_SPAWNVE) && defined(HAVE_SPAWNVPE) /* Implementation of pex->exec_child using the Cygwin spawn operation. */ diff --git a/gcc-4.8/libiberty/xmalloc.c b/gcc-4.8/libiberty/xmalloc.c index 3e97aab56..726ef6427 100644 --- a/gcc-4.8/libiberty/xmalloc.c +++ b/gcc-4.8/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) |