[llvm-bugs] [Bug 24379] New: Incorrect size of ELF symbol for a global alias
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Aug 6 10:29:05 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24379
Bug ID: 24379
Summary: Incorrect size of ELF symbol for a global alias
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: glider at google.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150806/d5ae29a8/attachment.html>
More information about the llvm-bugs
mailing list