From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.CeBiTec.Uni-Bielefeld.DE (smtp.CeBiTec.Uni-Bielefeld.DE [129.70.160.84]) by sourceware.org (Postfix) with ESMTPS id 876FA3858429 for ; Fri, 9 Sep 2022 20:50:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 876FA3858429 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=CeBiTec.Uni-Bielefeld.DE Authentication-Results: sourceware.org; spf=none smtp.mailfrom=cebitec.uni-bielefeld.de Received: from localhost (localhost [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 55D3CBD2B5; Fri, 9 Sep 2022 22:50:20 +0200 (CEST) X-Virus-Scanned: amavisd-new at CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (smtp.cebitec.uni-bielefeld.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YByoY0JLSg08; Fri, 9 Sep 2022 22:50:19 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (p5085519d.dip0.t-ipconnect.de [80.133.81.157]) (Authenticated sender: ro) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id 7A8F3BD319; Fri, 9 Sep 2022 22:50:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=CeBiTec.Uni-Bielefeld.DE; s=20200306; t=1662756619; bh=c4d3+TQScG8dzygCWOtrTPzhDbvJPL1nY2f46C8dj7w=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Rr7+aF/hYot+Ju3eSjl9pNRZUNbOrG5maXOyEZ8cUxYcUk0VQZfmyg30yIbos2Raq 77EGZWfXIab5p3X0K95VpKwMsRz1ejxzA6niDWFecZT8ZD4y99kgZ6K2WpysKEyR0H AQ5yJG2ukvwxmRG4D5xh+F1kNgHYtbjluZTO9Ef+ArSxl8xsoBj80pjUq66IbNk9DH qvHcINlquOLMWF0KkPQGGizXWg1LDvUV/d1n6XFbW8daRfAvc+jGtqPfI4REzX9UHb RSq6s8yD49QNsIyKj6R3PcXvgUZqv7LqF3xM3og+oqDSkne8vFLZROv3Z0vlPcc9tU KMMANiZG/Fz/w== From: Rainer Orth To: Jakub Jelinek via Gcc-patches Cc: Marcel Vollweiler , Jakub Jelinek , Iain Sandoe Subject: Re: [PATCH] OpenMP, libgomp: Environment variable syntax extension. References: <392c847d-e798-2be3-a808-6888de6c90cd@codesourcery.com> <73621930-22ce-c3f1-61e0-f15683f8b281@codesourcery.com> <055f7cfb-2849-ba5a-a161-13333e19e538@codesourcery.com> <7dc0eaf0-a3ed-8145-c43a-e9bb063f6acd@codesourcery.com> Date: Fri, 09 Sep 2022 22:50:19 +0200 In-Reply-To: (Jakub Jelinek via Gcc-patches's message of "Tue, 6 Sep 2022 13:51:48 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.90 (usg-unix-v) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Status: No, score=-3794.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --=-=-= Content-Type: text/plain 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 , 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... Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=ae.patch diff --git a/libgomp/env.c b/libgomp/env.c --- a/libgomp/env.c +++ b/libgomp/env.c @@ -54,6 +54,13 @@ #include #include "thread-stacksize.h" +#ifdef __APPLE__ +# include +# define environ (*_NSGetEnviron ()) +#else +extern char **environ; +#endif + #ifndef HAVE_STRTOULL # define strtoull(ptr, eptr, base) strtoul (ptr, eptr, base) #endif @@ -2033,7 +2040,6 @@ startswith (const char *str, const char static void __attribute__((constructor)) initialize_env (void) { - extern char **environ; char **env; int omp_var, dev_num = 0, dev_num_len = 0, i; bool ignore = false; --=-=-=--