public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <iain@sandoe.co.uk>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Rainer Orth <ro@cebitec.uni-bielefeld.de>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	Marcel Vollweiler <marcel@codesourcery.com>
Subject: Re: [PATCH] OpenMP, libgomp: Environment variable syntax extension.
Date: Fri, 9 Sep 2022 23:13:52 +0100	[thread overview]
Message-ID: <BAD90CF3-2E75-4D56-AEA9-3339A267E88A@sandoe.co.uk> (raw)
In-Reply-To: <Yxu5Zn+WOmn7y8hy@tucnak>



> On 9 Sep 2022, at 23:08, Jakub Jelinek <jakub@redhat.com> wrote:
> 
> On Fri, Sep 09, 2022 at 10:50:19PM +0200, Rainer Orth wrote:
>> Hi Jakub,
>> 
>>> On Wed, Aug 31, 2022 at 12:56:25PM +0200, Marcel Vollweiler wrote:
>>>> libgomp/ChangeLog:
>> [...]
>>>> 	(initialize_env): Extended to parse the new syntax of environment
>>>> 	variables.
>> 
>> this patch broke Darwin bootstrap:
>> 
>> Undefined symbols for architecture x86_64:
>>  "_environ", referenced from:
>>      _initialize_env in env.o
>> ld: symbol(s) not found for architecture x86_64
>> collect2: error: ld returned 1 exit status
>> make[5]: *** [libgomp.la] Error 1
>> 
>> This is documented in environ(7):
>> 
>>     Shared libraries and bundles don't have direct access to environ, which
>>     is only available to the loader ld(1) when a complete program is being
>>     linked.  The environment routines can still be used, but if direct access
>>     to environ is needed, the _NSGetEnviron() routine, defined in
>>     <crt_externs.h>, can be used to retrieve the address of environ at run-
>>     time.
>> 
>> The following patch/hack, taken from
>> libgfortran/intrinsics/execute_command_line.c, allows the link to
>> succeed.  Bootstrap still running...
> 
> My preference would be to introduce some new header for this, which would
> say define get_environ inline function, and define it as
> static inline char **
> get_environ (void)
> {
>  extern char **environ;
>  return environ;
> }
> in libgomp/config/posix/env.h
> and to that
> #include <crt_externs.h>
> 
> static inline char **
> get_environ (void)
> {
>  return *_NSGetEnviron ();
> }
> in libgomp/config/darwin/env.h
> That way it is easier to override it for other platforms if needed.

We already have such a header …
include/environ.h

Iain


  reply	other threads:[~2022-09-09 22:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18 15:22 Marcel Vollweiler
2022-01-18 16:10 ` [PATCH] " Marcel Vollweiler
2022-05-04 15:12   ` Jakub Jelinek
2022-05-04 15:52     ` Tobias Burnus
2022-06-10 13:59     ` Marcel Vollweiler
2022-06-30 11:40       ` Jakub Jelinek
2022-06-30 13:21         ` Jakub Jelinek
2022-06-30 17:13           ` Jakub Jelinek
2022-07-04 15:14         ` Jakub Jelinek
2022-07-25 13:38         ` Marcel Vollweiler
2022-08-02  7:52           ` Marcel Vollweiler
2022-08-22 15:35             ` Jakub Jelinek
2022-08-31 10:56               ` Marcel Vollweiler
2022-09-06 11:51                 ` Jakub Jelinek
2022-09-09 20:50                   ` Rainer Orth
2022-09-09 22:08                     ` Jakub Jelinek
2022-09-09 22:13                       ` Iain Sandoe [this message]
2022-09-09 22:17                         ` Jakub Jelinek
2022-09-10 13:17                           ` Iain Sandoe
2022-09-09 11:50                 ` [committed] libgomp: Fix up OMP_PROC_BIND handling [PR106894] Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAD90CF3-2E75-4D56-AEA9-3339A267E88A@sandoe.co.uk \
    --to=iain@sandoe.co.uk \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=marcel@codesourcery.com \
    --cc=ro@cebitec.uni-bielefeld.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).