aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2014-09-30 03:19:20 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-09-30 03:19:21 +0000
commitc5748954561f492fe1c4ea772e0290079af9960b (patch)
tree3a09c32395d4650ca0d8d52369889d17b578e477
parent05021208b41b37d068b4be95b921b3a1222cac09 (diff)
parentc2bbbc54a4871d875e0f034aad73df85679206a2 (diff)
downloadtoolchain_gcc-c5748954561f492fe1c4ea772e0290079af9960b.tar.gz
toolchain_gcc-c5748954561f492fe1c4ea772e0290079af9960b.tar.bz2
toolchain_gcc-c5748954561f492fe1c4ea772e0290079af9960b.zip
Merge "[4.8] Fix darwin gcc fails with gcc-ar which calls lto plugin"
-rw-r--r--gcc-4.8/libiberty/pex-unix.c8
-rw-r--r--gcc-4.8/libiberty/xmalloc.c8
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)