<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 --- - Incorrect size of ELF symbol for a global alias"
href="https://llvm.org/bugs/show_bug.cgi?id=24379">24379</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect size of ELF symbol for a global alias
</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>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>glider@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>Consider the following simplified example based on a Linux kernel module:
$ cat test.c
const int wacom_usb_ids[] = {1, 1, 2, 3, 5, 8, 13, 0};
extern const int __mod_usb_device_table __attribute__
((alias("wacom_usb_ids")));
The types of |wacom_usb_ids| and |__mod_usb_device_table| are different, which
doesn't really look good, but this pattern is extensively used in the kernel.
Both GCC 4.9 and Clang 3.7 produce ELF symbols of the same size for these
variables:
$ clang test.c -shared -o test.so && readelf -s test.so | grep usb
8: 0000000000000620 32 OBJECT GLOBAL DEFAULT 12
__mod_usb_device_table
9: 0000000000000620 32 OBJECT GLOBAL DEFAULT 12 wacom_usb_ids
43: 0000000000000620 32 OBJECT GLOBAL DEFAULT 12
__mod_usb_device_table
45: 0000000000000620 32 OBJECT GLOBAL DEFAULT 12 wacom_usb_ids
$ gcc test.c -shared -o test.so && readelf -s test.so | grep usb
8: 0000000000000680 32 OBJECT GLOBAL DEFAULT 13
__mod_usb_device_table
9: 0000000000000680 32 OBJECT GLOBAL DEFAULT 13 wacom_usb_ids
44: 0000000000000680 32 OBJECT GLOBAL DEFAULT 13
__mod_usb_device_table
46: 0000000000000680 32 OBJECT GLOBAL DEFAULT 13 wacom_usb_ids
However the ToT Clang (r244231) incorrectly generates the size of the
__mod_usb_device_table symbol (4 instead of 32)
$ $CLANG_BIN/clang test.c -shared -o test.so && readelf -s test.so | grep usb
8: 0000000000000620 4 OBJECT GLOBAL DEFAULT 12
__mod_usb_device_table
9: 0000000000000620 32 OBJECT GLOBAL DEFAULT 12 wacom_usb_ids
43: 0000000000000620 4 OBJECT GLOBAL DEFAULT 12
__mod_usb_device_table
45: 0000000000000620 32 OBJECT GLOBAL DEFAULT 12 wacom_usb_ids
Looks like a regression.</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>