public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "roland at gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/63758] New: liblto_plugin.so has undefined reference to _environ on OSX
Date: Thu, 06 Nov 2014 00:14:00 -0000	[thread overview]
Message-ID: <bug-63758-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2014-11-06  0:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06  0:14 roland at gnu dot org [this message]
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

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=bug-63758-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).