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

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