0033-build-Enable-64bit-off_t-on-32bit-glibc-systems.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From 48cf70c06ae6085ff3d1f8b28e323f153cff23c6 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Sun, 25 Dec 2022 15:13:41 -0800
  4. Subject: [PATCH] build: Enable 64bit off_t on 32bit glibc systems
  5. Pass -D_FILE_OFFSET_BITS=64 to compiler flags on 32bit glibc based
  6. systems. This will make sure that 64bit versions of LFS functions are
  7. used e.g. lseek will behave same as lseek64. Also revert [1] partially
  8. because this added a cmake test to detect lseek64 but then forgot to
  9. pass the needed macro during actual compile, this test was incomplete too
  10. since libc implementations like musl has 64-bit off_t by default on 32-bit
  11. systems and does not bundle -D_LARGEFILE64_SOURCE [2] under -D_GNU_SOURCE
  12. like glibc, which means the compile now fails on musl because the cmake
  13. check passes but we do not have _LARGEFILE64_SOURCE defined. Moreover,
  14. Using the *64 function was transitional anyways so use
  15. -D_FILE_OFFSET_BITS=64 instead
  16. [1] https://github.com/llvm/llvm-project/commit/8db7e5e4eed4c4e697dc3164f2c9351d8c3e942b
  17. [2] https://git.musl-libc.org/cgit/musl/commit/?id=25e6fee27f4a293728dd15b659170e7b9c7db9bc
  18. Upstream-Status: Pending
  19. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  20. ---
  21. utils/bazel/llvm-project-overlay/llvm/config.bzl | 1 -
  22. .../llvm-project-overlay/llvm/include/llvm/Config/config.h | 3 ---
  23. 2 files changed, 4 deletions(-)
  24. diff --git a/utils/bazel/llvm-project-overlay/llvm/config.bzl b/utils/bazel/llvm-project-overlay/llvm/config.bzl
  25. index 5507f80efa0b..b15ec9e1bb39 100644
  26. --- a/utils/bazel/llvm-project-overlay/llvm/config.bzl
  27. +++ b/utils/bazel/llvm-project-overlay/llvm/config.bzl
  28. @@ -48,7 +48,6 @@ posix_defines = [
  29. linux_defines = posix_defines + [
  30. "_GNU_SOURCE",
  31. "HAVE_LINK_H=1",
  32. - "HAVE_LSEEK64=1",
  33. "HAVE_MALLINFO=1",
  34. "HAVE_SBRK=1",
  35. "HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1",
  36. diff --git a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
  37. index 8a30957b6120..6a68ac040bb8 100644
  38. --- a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
  39. +++ b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
  40. @@ -144,9 +144,6 @@
  41. /* Define to 1 if you have the <link.h> header file. */
  42. /* HAVE_LINK_H defined in Bazel */
  43. -/* Define to 1 if you have the `lseek64' function. */
  44. -/* HAVE_LSEEK64 defined in Bazel */
  45. -
  46. /* Define to 1 if you have the <mach/mach.h> header file. */
  47. /* HAVE_MACH_MACH_H defined in Bazel */