public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/63758] New: liblto_plugin.so has undefined reference to _environ on OSX
@ 2014-11-06  0:14 roland at gnu dot org
  2014-11-06  0:17 ` [Bug other/63758] " roland at gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: roland at gnu dot org @ 2014-11-06  0:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63758

            Bug ID: 63758
           Summary: liblto_plugin.so has undefined reference to _environ
                    on OSX
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roland at gnu dot org
              Host: x86_64-apple-darwin
             Build: x86_64-apple-darwin11.4.2

Failure mode:

.../bin/../lib/gcc/.../4.9.2/../../../../.../bin/ld:
.../bin/../libexec/gcc/.../4.9.2/liblto_plugin.so: error loading plugin:
dlopen(.../bin/../libexec/gcc/.../4.9.2/liblto_plugin.so, 2): Symbol not found:
_environ
  Referenced from: .../bin/../libexec/gcc/.../4.9.2/liblto_plugin.so
  Expected in: flat namespace
 in .../bin/../libexec/gcc/.../4.9.2/liblto_plugin.so
collect2:error: ld returned 1 exit status

The references come from libiberty code (xmalloc.c and pex-unix.c).  Using
environ in a main program is fine, but it's documented on OSX that you
cannot use it from a shared library.  Instead, you must call the
_NSGetEnviron function to return its address (which also works just as well
in a main program).

I have a working fix which I'll attach shortly.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/63758] liblto_plugin.so has undefined reference to _environ on OSX
  2014-11-06  0:14 [Bug other/63758] New: liblto_plugin.so has undefined reference to _environ on OSX roland at gnu dot org
@ 2014-11-06  0:17 ` roland at gnu dot org
  2014-11-06  9:44 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: roland at gnu dot org @ 2014-11-06  0:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63758

--- Comment #1 from roland at gnu dot org ---
Created attachment 33903
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33903&action=edit
proposed patch

This patch fixes it on OSX.  I haven't verified it on a wide variety of
configurations.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/63758] liblto_plugin.so has undefined reference to _environ on OSX
  2014-11-06  0:14 [Bug other/63758] New: liblto_plugin.so has undefined reference to _environ on OSX roland at gnu dot org
  2014-11-06  0:17 ` [Bug other/63758] " roland at gnu dot org
@ 2014-11-06  9:44 ` rguenth at gcc dot gnu.org
  2014-11-27 23:34 ` iains at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-06  9:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63758

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |lto
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-11-06
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/63758] liblto_plugin.so has undefined reference to _environ on OSX
  2014-11-06  0:14 [Bug other/63758] New: liblto_plugin.so has undefined reference to _environ on OSX roland at gnu dot org
  2014-11-06  0:17 ` [Bug other/63758] " roland at gnu dot org
  2014-11-06  9:44 ` rguenth at gcc dot gnu.org
@ 2014-11-27 23:34 ` iains at gcc dot gnu.org
  2014-12-22 13:09 ` iains at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: iains at gcc dot gnu.org @ 2014-11-27 23:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63758

--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
I'm not disputing that the code is wrong…
 … and the change that you've put forward looks reasonable.

However, I'm not finding it easy to reproduce any failure - I've got a cross
from darwin12 => x86-64-linux-gnu with gold-enabled binutils.  

There's no failure at either build-time or runtime for the liblto plugin.

This is not entirely surprising (at least on the host I've tried), since the
plugin is linked with -Wl,-undefined,dynamic_lookup.  This means that _environ
will be resolved from the executable.

So I'm interested in how to reproduce the effect you show in c#1
>From gcc-bugs-return-468808-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Nov 28 01:13:18 2014
Return-Path: <gcc-bugs-return-468808-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15039 invoked by alias); 28 Nov 2014 01:13:18 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 14989 invoked by uid 48); 28 Nov 2014 01:13:03 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/64096] std::list, set and map violate a rule about allocator::construct
Date: Fri, 28 Nov 2014 01:13:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64096-4-ixnKNyNceU@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64096-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64096-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-11/txt/msg03280.txt.bz2
Content-length: 765

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd096

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to rylai from comment #0)
> As we can see, std::list implementation tries to call construct for whole
> list node (U = std::_List_node<int>),

This is already fixed on the SVN trunk, which will be GCC 5.

> and std::set and map (and also
> multiset and multimap) call it for right type (int or std::pair<const int,
> int>), but from rebinded allocator (T = std::_Rb_tree_node<int>).

I've discussed this extensively with the main author of  the C++11 allocator
proposals and other members of the committee. The standard is supposed to allow
that, the fact it doesn't is a defect, see
http://cplusplus.github.io/LWG/lwg-active.html#2218


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/63758] liblto_plugin.so has undefined reference to _environ on OSX
  2014-11-06  0:14 [Bug other/63758] New: liblto_plugin.so has undefined reference to _environ on OSX roland at gnu dot org
                   ` (2 preceding siblings ...)
  2014-11-27 23:34 ` iains at gcc dot gnu.org
@ 2014-12-22 13:09 ` iains at gcc dot gnu.org
  2015-09-03 12:42 ` nickc at redhat dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: iains at gcc dot gnu.org @ 2014-12-22 13:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63758

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #33903|0                           |1
        is obsolete|                            |
           Assignee|unassigned at gcc dot gnu.org      |iains at gcc dot gnu.org

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> ---
Created attachment 34311
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34311&action=edit
Updated patch to catch another use.

I'm taking this bug, if that's OK 
I'd like to post the revised patch to @patches
... but Roland can you confirm that's OK with you?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/63758] liblto_plugin.so has undefined reference to _environ on OSX
  2014-11-06  0:14 [Bug other/63758] New: liblto_plugin.so has undefined reference to _environ on OSX roland at gnu dot org
                   ` (3 preceding siblings ...)
  2014-12-22 13:09 ` iains at gcc dot gnu.org
@ 2015-09-03 12:42 ` nickc at redhat dot com
  2015-09-03 13:44 ` iains at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: nickc at redhat dot com @ 2015-09-03 12:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63758

Nick Clifton <nickc at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nickc at redhat dot com

--- Comment #5 from Nick Clifton <nickc at redhat dot com> ---
Ping ?

The patch works for us, and fixes a problem that a customer was having, so we
would really like to see it checked in.

Cheers
  Nick


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/63758] liblto_plugin.so has undefined reference to _environ on OSX
  2014-11-06  0:14 [Bug other/63758] New: liblto_plugin.so has undefined reference to _environ on OSX roland at gnu dot org
                   ` (4 preceding siblings ...)
  2015-09-03 12:42 ` nickc at redhat dot com
@ 2015-09-03 13:44 ` iains at gcc dot gnu.org
  2015-09-03 18:08 ` egall at gwmail dot gwu.edu
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: iains at gcc dot gnu.org @ 2015-09-03 13:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63758

--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Nick Clifton from comment #5)
> Ping ?
> 
> The patch works for us, and fixes a problem that a customer was having, so
> we would really like to see it checked in.

If I don't hear anything by the weekend, I'll post a rebased patch to @patches
(it's been in my local tree since ….)
>From gcc-bugs-return-496292-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Sep 03 13:57:14 2015
Return-Path: <gcc-bugs-return-496292-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15440 invoked by alias); 3 Sep 2015 13:57:14 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 15350 invoked by uid 48); 3 Sep 2015 13:57:10 -0000
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/67444] RHS of overloaded assignment not finalized
Date: Thu, 03 Sep 2015 13:57:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 5.2.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: kargl at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_severity
Message-ID: <bug-67444-4-ncFpNCylS9@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67444-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67444-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg00270.txt.bz2
Content-length: 276

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg444

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|blocker                     |normal


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/63758] liblto_plugin.so has undefined reference to _environ on OSX
  2014-11-06  0:14 [Bug other/63758] New: liblto_plugin.so has undefined reference to _environ on OSX roland at gnu dot org
                   ` (5 preceding siblings ...)
  2015-09-03 13:44 ` iains at gcc dot gnu.org
@ 2015-09-03 18:08 ` egall at gwmail dot gwu.edu
  2015-09-07 15:27 ` iains at gcc dot gnu.org
  2015-10-18 10:34 ` iains at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: egall at gwmail dot gwu.edu @ 2015-09-03 18:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63758

Eric Gallager <egall at gwmail dot gwu.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egall at gwmail dot gwu.edu

--- Comment #7 from Eric Gallager <egall at gwmail dot gwu.edu> ---
(In reply to Iain Sandoe from comment #4)
> Created attachment 34311 [details]
> Updated patch to catch another use.
> 
> I'm taking this bug, if that's OK 
> I'd like to post the revised patch to @patches
> ... but Roland can you confirm that's OK with you?

Re: the location of the "environ.h" added: could you put it in the include/
directory instead of in the libiberty/ directory, so that other directories in
the tree can use it more easily? libgcj, for instance, could use it, too, to
solve bug 38812, apparently...


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/63758] liblto_plugin.so has undefined reference to _environ on OSX
  2014-11-06  0:14 [Bug other/63758] New: liblto_plugin.so has undefined reference to _environ on OSX roland at gnu dot org
                   ` (6 preceding siblings ...)
  2015-09-03 18:08 ` egall at gwmail dot gwu.edu
@ 2015-09-07 15:27 ` iains at gcc dot gnu.org
  2015-10-18 10:34 ` iains at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: iains at gcc dot gnu.org @ 2015-09-07 15:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63758

--- Comment #8 from Iain Sandoe <iains at gcc dot gnu.org> ---
posted as
https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00447.html
with Eric's suggested move of environ.h -> include/
checked with a bootstrap on darwin12 that libiberty.a only contains references
to _NSGetEnviron().


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/63758] liblto_plugin.so has undefined reference to _environ on OSX
  2014-11-06  0:14 [Bug other/63758] New: liblto_plugin.so has undefined reference to _environ on OSX roland at gnu dot org
                   ` (7 preceding siblings ...)
  2015-09-07 15:27 ` iains at gcc dot gnu.org
@ 2015-10-18 10:34 ` iains at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: iains at gcc dot gnu.org @ 2015-10-18 10:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63758

--- Comment #9 from Iain Sandoe <iains at gcc dot gnu.org> ---
Author: iains
Date: Sun Oct 18 10:33:37 2015
New Revision: 228942

URL: https://gcc.gnu.org/viewcvs?rev=228942&root=gcc&view=rev
Log:
Fix PR63758 by using the _NSGetEnviron() API on Darwin

include/

        Roland McGrath  <roland@gnu.org>

        PR other/63758
        * environ.h: New file.

libiberty/

        Roland McGrath  <roland@gnu.org>
        Iain Sandoe  <iain@codesourcery.com>

        PR other/63758
        * pex-unix.c: Obtain the environment interface from settings in
environ.h
        rather than in-line code.  Update copyright date.
        * setenv.c: Likewise.
        * xmalloc.c: Likewise.



Added:
    trunk/include/environ.h
Modified:
    trunk/include/ChangeLog
    trunk/libiberty/ChangeLog
    trunk/libiberty/pex-unix.c
    trunk/libiberty/setenv.c
    trunk/libiberty/xmalloc.c


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-10-18 10:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-06  0:14 [Bug other/63758] New: liblto_plugin.so has undefined reference to _environ on OSX roland at gnu dot org
2014-11-06  0:17 ` [Bug other/63758] " roland at gnu dot org
2014-11-06  9:44 ` rguenth at gcc dot gnu.org
2014-11-27 23:34 ` iains at gcc dot gnu.org
2014-12-22 13:09 ` iains at gcc dot gnu.org
2015-09-03 12:42 ` nickc at redhat dot com
2015-09-03 13:44 ` iains at gcc dot gnu.org
2015-09-03 18:08 ` egall at gwmail dot gwu.edu
2015-09-07 15:27 ` iains at gcc dot gnu.org
2015-10-18 10:34 ` iains at gcc dot gnu.org

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).