[llvm-bugs] [Bug 31553] New: binutils assertion when guard vars are used with version script and old crt*.o (?)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 5 10:05:08 PST 2017


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

            Bug ID: 31553
           Summary: binutils assertion when guard vars are used with
                    version script and old crt*.o (?)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mgorny at gentoo.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17807
  --> https://llvm.org/bugs/attachment.cgi?id=17807&action=edit
qmenubar.cpp

I'm trying to figure out quite a complex issue we've hit recently on one of our
systems. I've been able to reduce it and find a reasonable way of reproducing
it.

Long story short:

clang++ -fuse-ld=bfd -nodefaultlibs -nostartfiles -O0
-Wl,--version-script,QtScript.version -shared -o test.so qmenubar.cpp
-std=c++1y -fPIC
clang++ -fuse-ld=bfd -nodefaultlibs -nostartfiles -shared -o test2.so test.so
/usr/bin/x86_64-pc-linux-gnu-ld.bfd: BFD (Gentoo 2.27 p1.0) 2.27 assertion fail
/tmp/portage/sys-devel/binutils-2.27/work/binutils-2.27/bfd/elflink.c:2694
/usr/bin/x86_64-pc-linux-gnu-ld.bfd: BFD (Gentoo 2.27 p1.0) 2.27 assertion fail
/tmp/portage/sys-devel/binutils-2.27/work/binutils-2.27/bfd/elflink.c:2694
clang-4.0: error: linker command failed with exit code 1 (use -v to see
invocation)
make: *** [Makefile:4: test2.so] Error 1


Note that -nostartfiles is specifically needed to reproduce this consistently.
FWICS this is because including crtbeginS.o+crtendS.o on my dev system seems to
make the issue disappear. However, it happens to me with the crt* files from
csu. Nevertheless, it looks suspicious that clang emits supposedly-invalid
symbol table unless appropriate crtbeginS.o/crtendS.o is linked in.

I'm attaching the test case code, version script and a Makefile that can be
used to reproduce easily.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170105/f3dc91e9/attachment.html>


More information about the llvm-bugs mailing list