[llvm-bugs] [Bug 40415] New: __WORDSIZE defined as 32 for aarch64-linux-gnu
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 22 15:00:22 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40415
Bug ID: 40415
Summary: __WORDSIZE defined as 32 for aarch64-linux-gnu
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Headers
Assignee: unassignedclangbugs at nondot.org
Reporter: ndesaulniers at google.com
CC: craig.topper at gmail.com, kristof.beyls at arm.com,
llvm-bugs at lists.llvm.org, peter.smith at linaro.org,
pirama at google.com, richard-llvm at metafoo.co.uk,
srhines at google.com
Created attachment 21365
--> https://bugs.llvm.org/attachment.cgi?id=21365&action=edit
wordsize.c
glibc's stdint.h for aarch64-linux-gnu uses the preprocessor symbol __WORDSIZE
to set the typedef of uint64_t. GCC sets this to symbol to 64, while Clang
sets it to 32 (I think Clang is in the wrong).
ex:
$ cat wordsize.c
#include <stdint.h>
int foo() {
return __WORDSIZE;
}
$ clang -target aarch64-linux-gnu -c wordsize.c
$ llvm-objdump -d wordsize.o
wordsize.o: file format ELF64-aarch64-little
Disassembly of section .text:
0000000000000000 foo:
0: e0 03 1b 32 orr w0, wzr, #0x20 ; 0x20 == 32
4: c0 03 5f d6 ret
$ aarch64-linux-gnu-gcc -c wordsize.c
$ llvm-objdump -d wordsize.o
wordsize.o: file format ELF64-aarch64-little
Disassembly of section .text:
0000000000000000 foo:
0: 00 08 80 52 mov w0, #64
4: c0 03 5f d6 ret
Relevant section from /usr/aarch64-linux-gnu/include/stdint.h:
#if __WORDSIZE == 64
typedef unsigned long int uint64_t;
#else
__extension__
typedef unsigned long long int uint64_t;
#endif
--
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/20190122/2f64144a/attachment.html>
More information about the llvm-bugs
mailing list