https://bugs.llvm.org/show_bug.cgi?id=33383

            Bug ID: 33383
           Summary: Linking static library does not resolve symbols as
                    gold/ld
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedb...@nondot.org
          Reporter: cl...@martinien.de
                CC: llvm-bugs@lists.llvm.org

Created attachment 18602
  --> https://bugs.llvm.org/attachment.cgi?id=18602&action=edit
Repro

[ This is spawned from an earlier email thread, see here:
  http://lists.llvm.org/pipermail/llvm-dev/2017-April/112114.html
  and reply from Rui:
  http://lists.llvm.org/pipermail/llvm-dev/2017-April/112353.html ]


Hi Rui,

I finally managed to come up with a reduced example, please find it
attached. You need to have GOLDPATH and LLDPATH set to point to the
respective linkers.

What happens in build.sh is that an object file is partially linked ("-u")
with gold first, then this is linked with lld to another object file for
the final executable. The resulting executable 'repro' then crashes during
static initialization.

The following changes make it work:
1) Using ld instead of gold for the first step
2) Using ld or gold for the second step

2) makes me think there must be something those linkers are doing, but lld
is not, that makes the whole thing work. But note that the crash happens
in a constructor. I found this for the "-u" option in the ld manpage here:

https://linux.die.net/man/1/ld

"When linking C++ programs, this option will not resolve references to
constructors; to do that, use -Ur."

However, gold does not know that option (and ld already works without it)

Any idea what is going wrong here?

Thanks and best regards
Martin

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to