<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - binutils assertion when guard vars are used with version script and old crt*.o (?)"
href="https://llvm.org/bugs/show_bug.cgi?id=31553">31553</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>binutils assertion when guard vars are used with version script and old crt*.o (?)
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mgorny@gentoo.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=17807" name="attach_17807" title="qmenubar.cpp">attachment 17807</a> <a href="attachment.cgi?id=17807&action=edit" title="qmenubar.cpp">[details]</a></span>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>