Use _NSGetEnviron to get environment. Tested on x86_64-pc-linux-gnu, committed on trunk
2015-01-07 Tristan Gingold <ging...@adacore.com> PR ada/64349 * env.c (__gnat_environ): Adjust for darwin9/darwin10.
Index: env.c =================================================================== --- env.c (revision 219191) +++ env.c (working copy) @@ -44,6 +44,12 @@ #include <stdlib.h> #endif +#if defined (__APPLE__) && !defined (__arm__) +/* On Darwin, _NSGetEnviron must be used for shared libraries; but it is not + available on iOS. */ +#include <crt_externs.h> +#endif + #if defined (__vxworks) #if defined (__RTP__) /* On VxWorks 6 Real-Time process mode, environ is defined in unistd.h. */ @@ -212,6 +218,8 @@ #elif ! (defined (__vxworks)) extern char **environ; return environ; +#elif defined (__APPLE__) && !defined (__arm__) + return *_NSGetEnviron (); #else return environ; #endif