<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 --- - lld confuses object files with the same name, but from different archive files in lto mode"
href="https://llvm.org/bugs/show_bug.cgi?id=30665">30665</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>lld confuses object files with the same name, but from different archive files in lto mode
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>ELF
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>krasin@google.com
</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=17426" name="attach_17426" title="the reproducer">attachment 17426</a> <a href="attachment.cgi?id=17426&action=edit" title="the reproducer">[details]</a></span>
the reproducer
Consider the following program (the full reproducer is attached):
main.cc uses symbols from two other files: one/timezone.cc and two/timezone.cc
(the "timezone" is irrelevant; the meaningful part is that the name are the
same, though that paths and contents are different).
The object files are linked through archives: libone.a and libtwo.a:
clang++ -o one/timezone.o -c one/timezone.cc -flto=thin
llvm-ar rcsD libone.a one/timezone.o
clang++ -o two/timezone.o -c two/timezone.cc -flto=thin
llvm-ar rcsD libtwo.a two/timezone.o
clang++ -c main.cc -flto=thin
clang++ -o main main.o libone.a libtwo.a -flto=thin -fuse-ld=lld
On top of that, it's ThinLTO, and full (not thin) archives.
This fails with:
$ ./build.sh
undefined symbol: base::CountryCodeForCurrentTimezone()
clang-3.9: error: linker command failed with exit code 1 (use -v to see
invocation)
Gold links correctly (so, it's not an LTO bug per se)
Full LTO (-flto) instead of -flto=thin links correctly
Regular (non-lto) build works correctly
Thin archives (rcsDT) work correctly.
So, it's a combination of lld + ThinLTO + regular archives + the object name
collision.</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>