From 22f1cc330d3501923d2dc27cd3fc424c69c3a73a Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 25 Dec 2022 19:22:10 -0800 Subject: clang: Refresh off64_t musl patch Signed-off-by: Khem Raj --- ...Enable-64bit-off_t-on-32bit-glibc-systems.patch | 101 +++++++++++++++------ 1 file changed, 74 insertions(+), 27 deletions(-) diff --git a/recipes-devtools/clang/clang/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch b/recipes-devtools/clang/clang/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch index 77bad54..7730c6f 100644 --- a/recipes-devtools/clang/clang/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch +++ b/recipes-devtools/clang/clang/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch @@ -1,19 +1,19 @@ -From e5edc21a119c9bc0bea6e942adf8b172ec8a987a Mon Sep 17 00:00:00 2001 +From cd2fa12d715929642513fc441287c402f4560096 Mon Sep 17 00:00:00 2001 From: Khem Raj -Date: Fri, 9 Dec 2022 16:17:12 -0800 -Subject: [PATCH] cmake: Enable 64bit off_t on 32bit glibc systems +Date: Sun, 25 Dec 2022 15:13:41 -0800 +Subject: [PATCH] build: Enable 64bit off_t on 32bit glibc systems Pass -D_FILE_OFFSET_BITS=64 to compiler flags on 32bit glibc based systems. This will make sure that 64bit versions of LFS functions are -used e.g. seek will behave same as lseek64. Also revert [1] partially +used e.g. lseek will behave same as lseek64. Also revert [1] partially because this added a cmake test to detect lseek64 but then forgot to -pass the needed macro to actual compile, this test was incomplete too -since libc implementations like musl has 64bit off_t by default on 32bit -systems and does not bundle[2] -D_LARGEFILE64_SOURCE under -D_GNU_SOURCE +pass the needed macro during actual compile, this test was incomplete too +since libc implementations like musl has 64-bit off_t by default on 32-bit +systems and does not bundle -D_LARGEFILE64_SOURCE [2] under -D_GNU_SOURCE like glibc, which means the compile now fails on musl because the cmake -check passes but we do not have _LARGEFILE64_SOURCE defined. Using the -*64 function was transitional anyways so use -D_FILE_OFFSET_BITS=64 -instead +check passes but we do not have _LARGEFILE64_SOURCE defined. Moreover, +Using the *64 function was transitional anyways so use +-D_FILE_OFFSET_BITS=64 instead [1] https://github.com/llvm/llvm-project/commit/8db7e5e4eed4c4e697dc3164f2c9351d8c3e942b [2] https://git.musl-libc.org/cgit/musl/commit/?id=25e6fee27f4a293728dd15b659170e7b9c7db9bc @@ -21,16 +21,18 @@ instead Upstream-Status: Submitted [https://reviews.llvm.org/D139752] Signed-off-by: Khem Raj --- - llvm/cmake/config-ix.cmake | 8 +++++--- - llvm/include/llvm/Config/config.h.cmake | 3 --- - llvm/lib/Support/raw_ostream.cpp | 2 -- - 3 files changed, 5 insertions(+), 8 deletions(-) + llvm/cmake/config-ix.cmake | 8 +++++--- + llvm/include/llvm/Config/config.h.cmake | 3 --- + llvm/lib/Support/raw_ostream.cpp | 2 -- + llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn | 2 -- + utils/bazel/llvm-project-overlay/llvm/config.bzl | 1 - + .../llvm/include/llvm/Config/config.h | 3 --- + utils/bazel/llvm_configs/config.h.cmake | 3 --- + 7 files changed, 5 insertions(+), 17 deletions(-) -diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake -index 7e657fd1532d..b03d433ea5b0 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake -@@ -284,9 +284,6 @@ check_symbol_exists(futimes sys/time.h HAVE_FUTIMES) +@@ -284,9 +284,6 @@ check_symbol_exists(futimes sys/time.h H if( HAVE_SIGNAL_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*" AND NOT APPLE ) check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK) endif() @@ -40,20 +42,18 @@ index 7e657fd1532d..b03d433ea5b0 100644 check_symbol_exists(mallctl malloc_np.h HAVE_MALLCTL) check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) check_symbol_exists(mallinfo2 malloc.h HAVE_MALLINFO2) -@@ -350,6 +347,11 @@ check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) +@@ -350,6 +347,11 @@ check_symbol_exists(__GLIBC__ stdio.h LL if( LLVM_USING_GLIBC ) add_definitions( -D_GNU_SOURCE ) list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") +# enable 64bit off_t on 32bit systems using glibc + if (CMAKE_SIZEOF_VOID_P EQUAL 4) -+ add_definitions( -D_FILE_OFFSET_BITS=64 ) ++ add_compile_definitions(_FILE_OFFSET_BITS=64) + list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64") + endif() endif() # This check requires _GNU_SOURCE if (NOT PURE_WINDOWS) -diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake -index 21ce3a94a5ed..d551ebad5c0c 100644 --- a/llvm/include/llvm/Config/config.h.cmake +++ b/llvm/include/llvm/Config/config.h.cmake @@ -128,9 +128,6 @@ @@ -66,11 +66,9 @@ index 21ce3a94a5ed..d551ebad5c0c 100644 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H} -diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp -index 651949ad5765..0bc71812cbd4 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp -@@ -804,8 +804,6 @@ uint64_t raw_fd_ostream::seek(uint64_t off) { +@@ -804,8 +804,6 @@ uint64_t raw_fd_ostream::seek(uint64_t o flush(); #ifdef _WIN32 pos = ::_lseeki64(FD, off, SEEK_SET); @@ -79,6 +77,55 @@ index 651949ad5765..0bc71812cbd4 100644 #else pos = ::lseek(FD, off, SEEK_SET); #endif --- -2.38.1 - +--- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn ++++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn +@@ -139,7 +139,6 @@ write_cmake_config("config") { + values += [ + "HAVE_FUTIMENS=1", + "HAVE_LINK_H=1", +- "HAVE_LSEEK64=1", + "HAVE_MALLINFO=1", + "HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1", + ] +@@ -147,7 +146,6 @@ write_cmake_config("config") { + values += [ + "HAVE_FUTIMENS=", + "HAVE_LINK_H=", +- "HAVE_LSEEK64=", + "HAVE_MALLINFO=", + "HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=", + ] +--- a/utils/bazel/llvm-project-overlay/llvm/config.bzl ++++ b/utils/bazel/llvm-project-overlay/llvm/config.bzl +@@ -40,7 +40,6 @@ posix_defines = [ + linux_defines = posix_defines + [ + "_GNU_SOURCE", + "HAVE_LINK_H=1", +- "HAVE_LSEEK64=1", + "HAVE_MALLINFO=1", + "HAVE_SBRK=1", + "HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1", +--- a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h ++++ b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h +@@ -144,9 +144,6 @@ + /* Define to 1 if you have the header file. */ + /* HAVE_LINK_H defined in Bazel */ + +-/* Define to 1 if you have the `lseek64' function. */ +-/* HAVE_LSEEK64 defined in Bazel */ +- + /* Define to 1 if you have the header file. */ + /* HAVE_MACH_MACH_H defined in Bazel */ + +--- a/utils/bazel/llvm_configs/config.h.cmake ++++ b/utils/bazel/llvm_configs/config.h.cmake +@@ -128,9 +128,6 @@ + /* Define to 1 if you have the header file. */ + #cmakedefine HAVE_LINK_H ${HAVE_LINK_H} + +-/* Define to 1 if you have the `lseek64' function. */ +-#cmakedefine HAVE_LSEEK64 ${HAVE_LSEEK64} +- + /* Define to 1 if you have the header file. */ + #cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H} + -- cgit v1.2.3-54-g00ecf