From 72dd53cb20f421d7036680319b0e66489378df8e Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 15 Dec 2023 11:59:57 -0800 Subject: [PATCH] Define __LONG_MAX in alltypes.h This is followup to #20752 which was supposed to define __LONG_MAX rather than LONG_MAX. You can see the effect of this change on some struct layouts in musl that contain checks like `#if __LONG_MAX > 0x7fffffff`. Since `__LONG_MAX` (and internal-only macro) is now correctly defined we get some slightly different values/layouts in libc. --- src/generated_struct_info32.json | 6 +++--- src/generated_struct_info64.json | 2 +- .../lib/sanitizer_common/sanitizer_platform_limits_posix.h | 3 +-- system/lib/libc/musl/arch/emscripten/bits/alltypes.h | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/generated_struct_info32.json b/src/generated_struct_info32.json index 94cad3db229ce..c51c65c1561f8 100644 --- a/src/generated_struct_info32.json +++ b/src/generated_struct_info32.json @@ -293,13 +293,13 @@ "F_DUPFD": 0, "F_GETFD": 1, "F_GETFL": 3, - "F_GETLK": 5, + "F_GETLK": 12, "F_GETOWN": 9, "F_GETOWN_EX": 16, "F_SETFD": 2, "F_SETFL": 4, - "F_SETLK": 6, - "F_SETLKW": 7, + "F_SETLK": 13, + "F_SETLKW": 14, "F_SETOWN": 8, "F_UNLCK": 2, "File::DataFileKind": 1, diff --git a/src/generated_struct_info64.json b/src/generated_struct_info64.json index 4695a2546c12b..fa54c2995b3c5 100644 --- a/src/generated_struct_info64.json +++ b/src/generated_struct_info64.json @@ -1421,7 +1421,7 @@ "iov_len": 8 }, "msghdr": { - "__size__": 48, + "__size__": 56, "msg_iov": 16, "msg_iovlen": 24, "msg_name": 0, diff --git a/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h index 08d1a685208be..9b3d95ef592c3 100644 --- a/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h @@ -445,8 +445,7 @@ struct __sanitizer_file_handle { }; #endif -// These fields are not actually pointers, and so wasm64 must use unsigned and not uptr for them -#if SANITIZER_APPLE || SANITIZER_EMSCRIPTEN +#if SANITIZER_APPLE struct __sanitizer_msghdr { void *msg_name; unsigned msg_namelen; diff --git a/system/lib/libc/musl/arch/emscripten/bits/alltypes.h b/system/lib/libc/musl/arch/emscripten/bits/alltypes.h index 408a32cefc908..148baddd8fd7b 100644 --- a/system/lib/libc/musl/arch/emscripten/bits/alltypes.h +++ b/system/lib/libc/musl/arch/emscripten/bits/alltypes.h @@ -4,7 +4,7 @@ #define __BYTE_ORDER __LITTLE_ENDIAN -#define LONG_MAX __LONG_MAX__ +#define __LONG_MAX __LONG_MAX__ #define _Addr __PTRDIFF_TYPE__ #define _Int64 __INT64_TYPE__