public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug go/56431] New: -lpthread should be added to -lgo
Date: Fri, 22 Feb 2013 23:45:00 -0000	[thread overview]
Message-ID: <bug-56431-4@http.gcc.gnu.org/bugzilla/> (raw)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56431

             Bug #: 56431
           Summary: -lpthread should be added to -lgo
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
        AssignedTo: ian@airs.com
        ReportedBy: hjl.tools@gmail.com
        Depends on: 56353


+++ This bug was initially created as a clone of Bug #56353 +++

libjava.jni/invocation/PR16923.c behaves differently, depending
on linking with gold or ld. _Jv_RegisterClasses is weak reference
and libgcj.so isn't on the linker command line. Since libgcj.so isn't
on the linker command line, gold resolves _Jv_RegisterClasses to 0 and
ld silently resolves it to _Jv_RegisterClasses in libgcj.so:

[hjl@gnu-13 testsuite]$ readelf -sWr /tmp/PR16923.gold | grep
_Jv_RegisterClasses 
     8: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
    37: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
[hjl@gnu-13 testsuite]$ readelf -sWr /tmp/PR16923.bfd | grep
_Jv_RegisterClasses 
0000000000600cd0  0000000900000007 R_X86_64_JUMP_SLOT     00000000004005e0
_Jv_RegisterClasses + 0
     9: 00000000004005e0     0 FUNC    WEAK   DEFAULT  UND _Jv_RegisterClasses
    59: 00000000004005e0     0 FUNC    WEAK   DEFAULT  UND _Jv_RegisterClasses
[hjl@gnu-13 testsuite]$]

-lgo has the same issue.  With the bfd linker, I got

[hjl@gnu-mic-2 go]$ ld --eh-frame-hdr -m elf_i386 -dynamic-linker
/lib/ld-linux.so.2 /lib/../lib/crt1.o /lib/../lib/crti.o
/export/build/gnu/gcc-asan/build-x86_64-linux/gcc/testsuite/go/../../32/crtbegin.o
-L/export/build/gnu/gcc-asan/build-x86_64-linux/x86_64-unknown-linux-gnu/32/libgo
-L/export/build/gnu/gcc-asan/build-x86_64-linux/x86_64-unknown-linux-gnu/32/libgo/.libs
-L/export/build/gnu/gcc-asan/build-x86_64-linux/gcc/testsuite/go/../../32
-L/lib/../lib -L/usr/lib/../lib
-L/export/build/gnu/gcc-asan/build-x86_64-linux/gcc/testsuite/go/../..
array-1.o -lgobegin -lgo -lm --wrap=pthread_create -lgcc_s -lgcc -lc -lgcc_s
-lgcc
/export/build/gnu/gcc-asan/build-x86_64-linux/gcc/testsuite/go/../../32/crtend.o
/lib/../lib/crtn.o
ld:
/export/build/gnu/gcc-asan/build-x86_64-linux/gcc/testsuite/go/../../32/libgcc.a(generic-morestack.o):
undefined reference to symbol 'pthread_sigmask@@GLIBC_2.0'
ld: note: 'pthread_sigmask@@GLIBC_2.0' is defined in DSO /lib/libpthread.so.0
so try adding it to the linker command line
/lib/libpthread.so.0: could not read symbols: Invalid operation
[hjl@gnu-mic-2 go]$ 

gold links, but it generates

    51: 00000000     0 NOTYPE  WEAK   DEFAULT  UND pthread_sigmask

It means that go executables generated by bfd ld and gold may behave
differently.  Go driver should add -lpthread to -lgo if libgo.so is
linked against libpthread.so.


             reply	other threads:[~2013-02-22 23:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-22 23:45 hjl.tools at gmail dot com [this message]
2013-02-27 14:54 ` [Bug go/56431] " ian at airs dot com
2013-02-27 16:59 ` hjl.tools at gmail dot com
2013-02-27 18:50 ` ian at airs dot com
2013-02-27 19:36 ` hjl.tools at gmail dot com
2013-02-27 21:08 ` ian at airs dot com
2013-02-27 21:21 ` hjl.tools at gmail dot com
2019-01-16 22:32 ` ian at airs dot com

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