[PATCH] D59702: Unbreak the build of compiler-rt on Linux/mips64el
Simon Atanasyan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 25 07:40:26 PDT 2019
atanasyan added inline comments.
================
Comment at: lib/sanitizer_common/sanitizer_platform_limits_linux.cc:31
#include <linux/posix_types.h>
-#if defined(__x86_64__) || defined(__mips__)
+#if defined(__x86_64__)
#include <sys/stat.h>
----------------
Why do you need this change?
================
Comment at: lib/sanitizer_common/sanitizer_platform_limits_posix.h:85
+ FIRST_32_SECOND_64(144, 104);
const unsigned struct_kernel_stat64_sz = 104;
#elif defined(__s390__) && !defined(__s390x__)
----------------
These numbers are sizes of the `struct stat` for 32 / 64-bit cases. Due the rL301171 32-bit size depends on definitions of the `_LARGEFILE_SOURCE` and `FILE_OFFSET_BITS=64` macros.
I run the following test case on Debian 9 mipsel 64-bit:
```
$ cat test.c
#include <stdio.h>
#include <sys/stat.h>
int main() {
printf("%u\n", sizeof(struct stat));
}
$ gcc -mabi=64 test.c && ./a.out
216
$ gcc -mabi=32 test.c -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 && ./a.out
160
```
Both numbers are the same as in the original version of the `sanitizer_platform_limits_posix.h`.
I guess that the `144` is `sizeof(struct stat)` in 32-bit case without proper `_LARGEFILE_SOURCE` and `_FILE_OFFSET_BITS=64` definitions. It looks like the code introduced by the rL301171 does not work in your case.
The `104` looks strange. It means that the size of `struct stat` in 32-bit case is larger than in the 64-bit one.
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59702/new/
https://reviews.llvm.org/D59702
More information about the llvm-commits
mailing list