<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - ELF symbol size for CFI vtable seems incorrect."
href="https://bugs.llvm.org/show_bug.cgi?id=44298">44298</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ELF symbol size for CFI vtable seems incorrect.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>netforce00@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Hello,
It seems the symbols for CFI vtables could get incorrect sizes. For each vtable
entries, instead of the actual size of the stub, it seems the total size of the
vtable is being used.
We could reproduce it with simple example.
$ cd `mktemp -d`
$ git clone <a href="https://github.com/trailofbits/clang-cfi-showcase">https://github.com/trailofbits/clang-cfi-showcase</a>
$ cd clang-cfi-showcase/
$ clang -g -flto -fsanitize=cfi -fvisibility=default cfi_icall.c
$ objdump -dS a.out
...
0000000000401478 <int_arg>:
401478: e9 83 fe ff ff jmpq 401300 <int_arg.cfi>
40147d: cc int3
40147e: cc int3
40147f: cc int3
0000000000401480 <bad_int_arg>:
401480: e9 bb fe ff ff jmpq 401340 <bad_int_arg.cfi>
401485: cc int3
401486: cc int3
401487: cc int3
0000000000401488 <not_entry_point>:
401488: e9 53 ff ff ff jmpq 4013e0 <not_entry_point.cfi>
40148d: cc int3
40148e: cc int3
40148f: cc int3
...
$ readelf -sW a.out
Num: Value Size Type Bind Vis Ndx Name
...
43: 0000000000401480 24 FUNC LOCAL DEFAULT 13 bad_int_arg
...
47: 0000000000401478 24 FUNC LOCAL DEFAULT 13 int_arg
...
49: 0000000000401488 24 FUNC LOCAL DEFAULT 13 not_entry_point
...
This makes the symbols in the vtable overlap. To generate AutoFDO profile, we
have some tool list all symbols for a list of addresses, and this many
overlapping symbols cause our tool OOM.
We believe the same issue was noticed by Chrome folks too:
<a href="https://bugs.chromium.org/p/chromium/issues/detail?id=947114">https://bugs.chromium.org/p/chromium/issues/detail?id=947114</a>
Could you take a look if more accurate symbol sizes can be given?
Thank you in advance,
HK</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>