This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, libiberty] Fix PR63758 by using the _NSGetEnviron() API on Darwin.
- From: Iain Sandoe <iain at codesourcery dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>, <roland at gnu dot org>, Ian Lance Taylor <ian at airs dot com>, Nick Clifton <nickc at redhat dot com>
- Date: Sun, 18 Oct 2015 11:42:41 +0100
- Subject: Re: [PATCH, libiberty] Fix PR63758 by using the _NSGetEnviron() API on Darwin.
- Authentication-results: sourceware.org; auth=none
- References: <37D7634D-114B-4D35-91E4-5E5237FA487D at codesourcery dot com> <CAKOQZ8w6QPK=CjAoFWzAvCTuuuycoow3C=pK_8MPA9o7dDSMtw at mail dot gmail dot com> <E7FAA47D-0CC5-45AB-9B69-B492D730E193 at codesourcery dot com> <CAKOQZ8zWGXeWHUsUrZaRDLN4KwY-Ey0U96sO7+H6piaBEtwL-Q at mail dot gmail dot com>
On 8 Sep 2015, at 15:27, Ian Lance Taylor wrote:
> On Tue, Sep 8, 2015 at 7:20 AM, Iain Sandoe <iain@codesourcery.com> wrote:
>>
>>> This seems likely to break cross-compilers to Darwin that do not have
>>> the system libraries available. I guess I don't care about that if
>>> you don't.
>>
>> I do care about it, but I'm not visualising the case...
>>
>> AFAICS, when built as a host component for a cross to Darwin from non-Darwin, environ would be declared as **environ as usual.
>>
>> If an implementation includes a compiler targeting Darwin that defines __APPLE__ but doesn't provide _NSGetEnviron in its libc, then isn't it broken anyway?
>
> I'm talking about the case of building a cross-compiler where the
> system libraries are not available. This is sometimes done as a first
> step toward building a full cross-compiler.
I've applied the patch since it solves an immediate problem (and has been requested).
Right now, the only case that I can think of when there's a Darwin-hosted statically-linked user-space executable is in bringing up the system itself, in which case one has to build non-standard crts and a statically-linkable libc. Last time I did this was on 10.5 with the darwinbuild stuff, not sure it's even feasible on modern Darwin which is built with a different compiler.
It's possible that making the Darwin case conditional on ! defined(__STATIC__) might be sufficient to guard that, but I need to think of some way to test it.
Iain