<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 --- - Typeinfo references not merged"
href="https://llvm.org/bugs/show_bug.cgi?id=23102">23102</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Typeinfo references not merged
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rafael.espindola@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Given
test.cpp:
------------------------
void f();
void g() {
try {
f();
} catch (int x) {
}
}
-------------------------
test2.cpp:
--------------------------
void f();
void h() {
try {
f();
} catch (int x) {
}
}
------------------------------
With gcc
$ gcc test.cpp test2.cpp -O3 -fPIC -shared -o test.so
$ readelf -r test.so | grep ZTI
000000001c88 000b00000001 R_X86_64_64 0000000000000000 _ZTIi + 0
with clang:
$ clang test.cpp test2.cpp -O3 -fPIC -shared -o test.so
$ readelf -r test.so | grep ZTI
000000001bf0 000700000001 R_X86_64_64 0000000000000000 _ZTIi + 0
000000001bf8 000700000001 R_X86_64_64 0000000000000000 _ZTIi + 0
The difference is that gcc puts the reference to the typeinfo in a comdat
section:
.section .data.DW.ref._ZTIi,"awG",@progbits,DW.ref._ZTIi,comdat
...
.quad _ZTIi</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>