diff mbox series

[meta-oe] gperftools: Define off64_t on musl

Message ID 20221226041430.3700024-1-raj.khem@gmail.com
State New
Headers show
Series [meta-oe] gperftools: Define off64_t on musl | expand

Commit Message

Khem Raj Dec. 26, 2022, 4:14 a.m. UTC
alias it to off_t which is 64bit always on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...0001-Define-off64_t-as-off_t-on-musl.patch | 33 ++++++++++++++++++
 .../0001-fix-build-with-musl-libc.patch       | 34 -------------------
 .../gperftools/gperftools_2.10.bb             |  2 +-
 3 files changed, 34 insertions(+), 35 deletions(-)
 create mode 100644 meta-oe/recipes-support/gperftools/gperftools/0001-Define-off64_t-as-off_t-on-musl.patch
 delete mode 100644 meta-oe/recipes-support/gperftools/gperftools/0001-fix-build-with-musl-libc.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/gperftools/gperftools/0001-Define-off64_t-as-off_t-on-musl.patch b/meta-oe/recipes-support/gperftools/gperftools/0001-Define-off64_t-as-off_t-on-musl.patch
new file mode 100644
index 0000000000..2b782c2040
--- /dev/null
+++ b/meta-oe/recipes-support/gperftools/gperftools/0001-Define-off64_t-as-off_t-on-musl.patch
@@ -0,0 +1,33 @@ 
+From 41260e21e271eb1dc8b34f952ea3f90a0dc35e9e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 25 Dec 2022 20:01:29 -0800
+Subject: [PATCH] Define off64_t as off_t on musl
+
+Musl's default bitlength for off_t is always 64bit therefore define
+off64_t as off_t on musl
+
+Upstream-Status: Submitted [https://github.com/gperftools/gperftools/pull/1379]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/malloc_hook_mmap_linux.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h
+index c7d8b4b..a10687e 100644
+--- a/src/malloc_hook_mmap_linux.h
++++ b/src/malloc_hook_mmap_linux.h
+@@ -45,6 +45,11 @@
+ #include <sys/syscall.h>
+ #include <unistd.h>
+ 
++// musl's off_t is already 64-bit
++#if defined(__linux__) && !defined(__GLIBC__)
++typedef off_t off64_t;
++#endif
++
+ // The x86-32 case and the x86-64 case differ:
+ // 32b has a mmap2() syscall, 64b does not.
+ // 64b and 32b have different calling conventions for mmap().
+-- 
+2.39.0
+
diff --git a/meta-oe/recipes-support/gperftools/gperftools/0001-fix-build-with-musl-libc.patch b/meta-oe/recipes-support/gperftools/gperftools/0001-fix-build-with-musl-libc.patch
deleted file mode 100644
index baaaa4b53b..0000000000
--- a/meta-oe/recipes-support/gperftools/gperftools/0001-fix-build-with-musl-libc.patch
+++ /dev/null
@@ -1,34 +0,0 @@ 
-From 696674a800cb6d2070897a565b92d7e63022a8f1 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sun, 16 Jul 2017 15:51:28 -0700
-Subject: [PATCH] fix build with musl libc
-
-Patch from https://github.com/gperftools/gperftools/pull/765/
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- src/malloc_hook_mmap_linux.h | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
---- a/src/malloc_hook_mmap_linux.h
-+++ b/src/malloc_hook_mmap_linux.h
-@@ -45,6 +45,10 @@
- #include <sys/syscall.h>
- #include <unistd.h>
- 
-+#ifndef __GLIBC__
-+typedef off64_t   __off64_t;
-+#endif
-+
- // The x86-32 case and the x86-64 case differ:
- // 32b has a mmap2() syscall, 64b does not.
- // 64b and 32b have different calling conventions for mmap().
-@@ -175,7 +179,7 @@ extern "C" void* mmap64(void *start, siz
-   return result;
- }
- 
--# if !defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH)
-+# if defined(__GLIBC__) && (!defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH))
- 
- extern "C" void* mmap(void *start, size_t length, int prot, int flags,
-                       int fd, off_t offset) __THROW {
diff --git a/meta-oe/recipes-support/gperftools/gperftools_2.10.bb b/meta-oe/recipes-support/gperftools/gperftools_2.10.bb
index 602a7e263a..8db0cecbfd 100644
--- a/meta-oe/recipes-support/gperftools/gperftools_2.10.bb
+++ b/meta-oe/recipes-support/gperftools/gperftools_2.10.bb
@@ -13,10 +13,10 @@  DEPENDS:append:libc-musl = " libucontext"
 SRCREV = "bf8b714bf5075d0a6f2f28504b43095e2b1e11c5"
 SRC_URI = "git://github.com/gperftools/gperftools;branch=master;protocol=https \
            file://0001-Support-Atomic-ops-on-clang.patch \
-           file://0001-fix-build-with-musl-libc.patch \
            file://0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch \
            file://disable_libunwind_aarch64.patch \
            file://sgidef.patch \
+           file://0001-Define-off64_t-as-off_t-on-musl.patch \
            "
 
 SRC_URI:append:libc-musl = " file://ppc-musl.patch"