Closed glaubitz closed 2 years ago
Reported in glibc as https://sourceware.org/bugzilla/show_bug.cgi?id=27574
On a sparc64, in bits/wordsize.h, we have:
for -mcpu=v9 and -m32, gcc defines:
glaubitz@gcc202:~$ echo | gcc -E -dM -mcpu=v9 -m32 - |grep v9
glaubitz@gcc202:~$
while clang defines:
glaubitz@gcc202:~$ echo | /home/glaubitz/llvm-project/stage1.install/bin/clang -E -dM -mcpu=v9 -m32 - |grep v9
glaubitz@gcc202:~$
This should be resolved with 14.0.0 and newer.
Extended Description
Test case:
glaubitz@gcc202:~$ cat test.c
include
include <bits/wordsize.h>
int main () {
if __WORDSIZE == 32
elif __WORDSIZE == 64
endif
}
With gcc:
glaubitz@gcc202:~$ gcc test.c -o test -m32 -mcpu=v9 glaubitz@gcc202:~$ file test test: ELF 32-bit MSB pie executable, SPARC32PLUS, V8+ Required, total store ordering, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=e29c566d1d767ede628ff31e5a32df089341caea, for GNU/Linux 3.2.0, not stripped glaubitz@gcc202:~$ ./test Hello 32-bit World! glaubitz@gcc202:~$
With clang:
glaubitz@gcc202:~$ llvm-project/stage1.install/bin/clang test.c -o test -m32 -mcpu=v9 glaubitz@gcc202:~$ file test test: ELF 32-bit MSB executable, SPARC32PLUS, V8+ Required, total store ordering, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 3.2.0, not stripped glaubitz@gcc202:~$ ./test Hello 64-bit World! glaubitz@gcc202:~$