From 318a3aa1860c7e10bb8d27bfe9e842fdf98d300c Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 24 Aug 2023 14:54:02 -0700 Subject: [PATCH] Re-enable _LARGEFILE64_SOURCE when _GNU_SOURCE is defined When we updated to the latest version of musl it broke some codebases that were using LFS functions (e.g. `stat64`) and assuming those functions would be defined when `_GNU_SOURCE` is defined. See https://github.com/bminor/musl/commit/25e6fee27f4a293728dd15b659170e7b9c7db9bc This change effectively reverts the above one by defining _LARGEFILE64_SOURCE whenever _GNU_SOURCE is defined. This is what glibc does: https://github.com/lattera/glibc/blob/895ef79e04a953cac1493863bcae29ad85657ee1/include/features.h#L206 --- system/lib/libc/musl/include/features.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/lib/libc/musl/include/features.h b/system/lib/libc/musl/include/features.h index 85cfb72a0d427..eab414d2d2bd9 100644 --- a/system/lib/libc/musl/include/features.h +++ b/system/lib/libc/musl/include/features.h @@ -16,6 +16,11 @@ #define _XOPEN_SOURCE 700 #endif +#if defined(_GNU_SOURCE) +#undef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE 1 +#endif + #if __STDC_VERSION__ >= 199901L #define __restrict restrict #elif !defined(__GNUC__)