diff options
| author | Khem Raj <raj.khem@gmail.com> | 2022-12-28 23:12:31 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-31 17:08:29 +0000 |
| commit | ed134c9247fe8725bfa671e916d9f0eba91ed2ef (patch) | |
| tree | c74bc246059ba70946eba6df58f5297fa60a7f8a /meta/recipes-devtools/rust | |
| parent | 755540ec8f978c21d3d7a49177da2da861301d74 (diff) | |
| download | poky-ed134c9247fe8725bfa671e916d9f0eba91ed2ef.tar.gz | |
rust-llvm: Fix build on latest musl
latest musl has removed lfs64 functions
(From OE-Core rev: 7156416943dc6d772020465917418e3234cc7f66)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rust')
| -rw-r--r-- | meta/recipes-devtools/rust/rust-llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch | 79 | ||||
| -rw-r--r-- | meta/recipes-devtools/rust/rust-llvm_1.66.0.bb | 3 |
2 files changed, 81 insertions, 1 deletions
diff --git a/meta/recipes-devtools/rust/rust-llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch b/meta/recipes-devtools/rust/rust-llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch new file mode 100644 index 0000000000..fe98e3e4c0 --- /dev/null +++ b/meta/recipes-devtools/rust/rust-llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | From cd2fa12d715929642513fc441287c402f4560096 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 | |||
| 6 | Pass -D_FILE_OFFSET_BITS=64 to compiler flags on 32bit glibc based | ||
| 7 | systems. This will make sure that 64bit versions of LFS functions are | ||
| 8 | used e.g. lseek will behave same as lseek64. Also revert [1] partially | ||
| 9 | because this added a cmake test to detect lseek64 but then forgot to | ||
| 10 | pass the needed macro during actual compile, this test was incomplete too | ||
| 11 | since libc implementations like musl has 64-bit off_t by default on 32-bit | ||
| 12 | systems and does not bundle -D_LARGEFILE64_SOURCE [2] under -D_GNU_SOURCE | ||
| 13 | like glibc, which means the compile now fails on musl because the cmake | ||
| 14 | check passes but we do not have _LARGEFILE64_SOURCE defined. Moreover, | ||
| 15 | Using the *64 function was transitional anyways so use | ||
| 16 | -D_FILE_OFFSET_BITS=64 instead | ||
| 17 | |||
| 18 | [1] https://github.com/llvm/llvm-project/commit/8db7e5e4eed4c4e697dc3164f2c9351d8c3e942b | ||
| 19 | [2] https://git.musl-libc.org/cgit/musl/commit/?id=25e6fee27f4a293728dd15b659170e7b9c7db9bc | ||
| 20 | |||
| 21 | Upstream-Status: Submitted [https://reviews.llvm.org/D139752] | ||
| 22 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 23 | --- | ||
| 24 | llvm/cmake/config-ix.cmake | 8 +++++--- | ||
| 25 | llvm/include/llvm/Config/config.h.cmake | 3 --- | ||
| 26 | llvm/lib/Support/raw_ostream.cpp | 2 -- | ||
| 27 | llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn | 2 -- | ||
| 28 | utils/bazel/llvm-project-overlay/llvm/config.bzl | 1 - | ||
| 29 | .../llvm/include/llvm/Config/config.h | 3 --- | ||
| 30 | utils/bazel/llvm_configs/config.h.cmake | 3 --- | ||
| 31 | 7 files changed, 5 insertions(+), 17 deletions(-) | ||
| 32 | |||
| 33 | --- a/llvm/cmake/config-ix.cmake | ||
| 34 | +++ b/llvm/cmake/config-ix.cmake | ||
| 35 | @@ -284,9 +284,6 @@ check_symbol_exists(futimes sys/time.h H | ||
| 36 | if( HAVE_SIGNAL_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*" AND NOT APPLE ) | ||
| 37 | check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK) | ||
| 38 | endif() | ||
| 39 | -set(CMAKE_REQUIRED_DEFINITIONS "-D_LARGEFILE64_SOURCE") | ||
| 40 | -check_symbol_exists(lseek64 "sys/types.h;unistd.h" HAVE_LSEEK64) | ||
| 41 | -set(CMAKE_REQUIRED_DEFINITIONS "") | ||
| 42 | check_symbol_exists(mallctl malloc_np.h HAVE_MALLCTL) | ||
| 43 | check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) | ||
| 44 | check_symbol_exists(mallinfo2 malloc.h HAVE_MALLINFO2) | ||
| 45 | @@ -350,6 +347,11 @@ check_symbol_exists(__GLIBC__ stdio.h LL | ||
| 46 | if( LLVM_USING_GLIBC ) | ||
| 47 | add_definitions( -D_GNU_SOURCE ) | ||
| 48 | list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") | ||
| 49 | +# enable 64bit off_t on 32bit systems using glibc | ||
| 50 | + if (CMAKE_SIZEOF_VOID_P EQUAL 4) | ||
| 51 | + add_compile_definitions(_FILE_OFFSET_BITS=64) | ||
| 52 | + list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64") | ||
| 53 | + endif() | ||
| 54 | endif() | ||
| 55 | # This check requires _GNU_SOURCE | ||
| 56 | if (NOT PURE_WINDOWS) | ||
| 57 | --- a/llvm/include/llvm/Config/config.h.cmake | ||
| 58 | +++ b/llvm/include/llvm/Config/config.h.cmake | ||
| 59 | @@ -128,9 +128,6 @@ | ||
| 60 | /* Define to 1 if you have the <link.h> header file. */ | ||
| 61 | #cmakedefine HAVE_LINK_H ${HAVE_LINK_H} | ||
| 62 | |||
| 63 | -/* Define to 1 if you have the `lseek64' function. */ | ||
| 64 | -#cmakedefine HAVE_LSEEK64 ${HAVE_LSEEK64} | ||
| 65 | - | ||
| 66 | /* Define to 1 if you have the <mach/mach.h> header file. */ | ||
| 67 | #cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H} | ||
| 68 | |||
| 69 | --- a/llvm/lib/Support/raw_ostream.cpp | ||
| 70 | +++ b/llvm/lib/Support/raw_ostream.cpp | ||
| 71 | @@ -804,8 +804,6 @@ uint64_t raw_fd_ostream::seek(uint64_t o | ||
| 72 | flush(); | ||
| 73 | #ifdef _WIN32 | ||
| 74 | pos = ::_lseeki64(FD, off, SEEK_SET); | ||
| 75 | -#elif defined(HAVE_LSEEK64) | ||
| 76 | - pos = ::lseek64(FD, off, SEEK_SET); | ||
| 77 | #else | ||
| 78 | pos = ::lseek(FD, off, SEEK_SET); | ||
| 79 | #endif | ||
diff --git a/meta/recipes-devtools/rust/rust-llvm_1.66.0.bb b/meta/recipes-devtools/rust/rust-llvm_1.66.0.bb index 4cf244bb67..4cc57d12ae 100644 --- a/meta/recipes-devtools/rust/rust-llvm_1.66.0.bb +++ b/meta/recipes-devtools/rust/rust-llvm_1.66.0.bb | |||
| @@ -10,7 +10,8 @@ require rust-source.inc | |||
| 10 | 10 | ||
| 11 | SRC_URI += "file://0002-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ | 11 | SRC_URI += "file://0002-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ |
| 12 | file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ | 12 | file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ |
| 13 | file://0003-llvm-fix-include-benchmarks.patch;striplevel=2" | 13 | file://0003-llvm-fix-include-benchmarks.patch;striplevel=2 \ |
| 14 | file://0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch;striplevel=2" | ||
| 14 | 15 | ||
| 15 | S = "${RUSTSRC}/src/llvm-project/llvm" | 16 | S = "${RUSTSRC}/src/llvm-project/llvm" |
| 16 | 17 | ||
