<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/83509>83509</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-offload-bundler mixes symbols from different objects when unbundling an archive
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
LU-JOHN
</td>
</tr>
</table>
<pre>
Change to clang/lib/Driver/OffloadBundler.cpp in commit https://github.com/llvm/llvm-project/pull/81700 causes clang-offload-bundler to join symbols from different objects when unbundling an archive:
Source file s.cpp:
> void bazball() {
> }
Source file t.cpp:
> void foobar() {
> }
Commands:
> clang++ -c s.cpp -o s.o;
> clang-offload-bundler -type=o -targets=host-x86_64-unknown-linux-gnu -input=s.o -output=s_bundled.o;
> clang++ -c t.cpp -o t.o;
> clang-offload-bundler -type=o -targets=host-x86_64-unknown-linux-gnu -input=t.o -output=t_bundled.o;
> llvm-ar cr bundled.a s_bundled.o t_bundled.o
> clang-offload-bundler -unbundle --targets=host-x86_64-unknown-linux-gnu -type=aoo -input=bundled.a -output=t_list.txt; nm \`cat t_list.txt\`
The output of the nm command without the change is:
> bundled-742762.o:
> 0000000000000000 T _Z7bazballv
> bundled-61506b.o:
> 0000000000000000 T _Z6foobarv
>
The output with the change is:
> /tmp/bundled-e7ca35.o:s_bundled.o:
> 0000000000000000 T _Z7bazballvt_bundled.o:
> 0000000000000000 T _Z6foobarv
>
> /tmp/bundled-5ea078.o:s_bundled.o:
> 0000000000000000 T _Z7bazballvt_bundled.o:
> 0000000000000000 T _Z6foobarv
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8lc9u4zYQxp-GugxoUKQl2Qcd6rhCURTdQ7eXXgKKoiRuKVLgHyfp0xeUnNqbeLFOgdYHG9Zwvvl91AyGe68GI2WNigMqjhmPYbSu_uV3_POnn37NWtu91A8jN4OEYEFobgZEG61aRJujUyfpEG0-9b22vDtE02npNmKeQRkQdppUgDGE2SP2A6INos2gwhjbjbBTktGn1x88O_tFioBoM0etEW12eUUICB699GthbNc6uF0LJaIvVhnwL1NrtYfe2Qk61ffSSRPAtknRw9MoDUSzZCkzADfAnRjVSSYsckTk_P2bjU5I6JWW4JONS5z9CCerOmj5Xy1PfDtE94CqwyWOqiN8Sy3cVuutbbm7R-zBThM3nX9DnI6eX8oB0QNgsYIDYAt-YxE7vDn47hJxeJklYkcLgAN3gwweseNofcDPu_Kx3OJo_jT2yWCtTHzGg4mAlZljQOzoNynNxnD--7iqdrcqXxDDP4jhv0cMXyOGbyAuTcgdCAevBzhc-YHrxO_wAj53mwR8P_DZJLf2An9BuXaglQ-b8BwQO4CZABUPqCSCB7gKLc-uW-XzKGHVANtDGGVKFWtbwZMKo41heSzWcVe3eu3Mg6strUqarvAqSN584DM8_lGdJ-b0XqTMC1K294iU66Cc4GpAbltLRr7rAtEmTDOizSuJrARnxULyVQvfbS58JOvVzTszt9AKyUm1-7_RIOtq1u3ZnmeyziuypwXLWZ6Ndb-v9oQRSUTJaFf2rdiJHekp7clW7lmRqZoSuiWM5IQwmuebXcfKqt8WMif5VooSbYmcuNKbNHIb64ZMeR9lvWMF2Weat1L7ZR1RauQTLEFEadpOrl7GtI2DR1uSet1fVIIKWta3J3JSz9L_-z2RRafrDy-yhdynVZac_R0AAP__LT9FhA">