gperftools: Upgrade to 2.6.1

Fix build with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Khem Raj
2017-07-22 09:50:42 -07:00
committed by Martin Jansa
parent 8e2393a92b
commit 3ec1e79aa0
4 changed files with 102 additions and 34 deletions
@@ -1,28 +0,0 @@
Subject: Fix build failure for ppc
Upstream-Status: Pending
Fix the following build failure.
error: 'siginfo_t' does not name a type
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
src/stacktrace_powerpc-linux-inl.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/stacktrace_powerpc-linux-inl.h b/src/stacktrace_powerpc-linux-inl.h
index 5d16fa1..a9bf775 100644
--- a/src/stacktrace_powerpc-linux-inl.h
+++ b/src/stacktrace_powerpc-linux-inl.h
@@ -44,6 +44,7 @@
#include <stdint.h> // for uintptr_t
#include <stdlib.h> // for NULL
+#include <signal.h> // for siginfo_t
#include <gperftools/stacktrace.h>
#include <base/vdso_support.h>
--
2.8.3
@@ -0,0 +1,61 @@
From 157914941bd38f1a38bb6bd7294ca6c2bc1b8dcb 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>
---
configure.ac | 1 +
src/malloc_hook_mmap_linux.h | 8 ++++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index b42fea3..70b49a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -188,6 +188,7 @@ AC_HEADER_STDC
AC_CHECK_TYPES([__int64]) # defined in some windows platforms
AC_CHECK_TYPES([struct mallinfo],,, [#include <malloc.h>])
AC_CHECK_TYPES([Elf32_Versym],,, [#include <elf.h>]) # for vdso_support.h
+AC_CHECK_FUNCS(__sbrk) # for intercepting glibc memory allocator
AC_CHECK_FUNCS(sbrk) # for tcmalloc to get memory
AC_CHECK_FUNCS(geteuid) # for turning off services when run as root
AC_CHECK_FUNCS(fork) # for the pthread_atfork setup
diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h
index 79ac4e3..d444635 100755
--- a/src/malloc_hook_mmap_linux.h
+++ b/src/malloc_hook_mmap_linux.h
@@ -46,6 +46,10 @@
#include <errno.h>
#include "base/linux_syscall_support.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().
@@ -168,7 +172,7 @@ extern "C" void* mmap64(void *start, size_t length, int prot, int flags,
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 {
@@ -206,7 +210,7 @@ extern "C" void* mremap(void* old_addr, size_t old_size, size_t new_size,
return result;
}
-#ifndef __UCLIBC__
+#if HAVE___SBRK
// libc's version:
extern "C" void* __sbrk(ptrdiff_t increment);
--
2.13.3
@@ -0,0 +1,28 @@
From 04ea8e001501931f4dbf20288aca78469617b08a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 16 Jul 2017 19:28:17 -0700
Subject: [PATCH] include fcntl.h for loff_t definition
Fixes
linux_syscall_support.h:2641:26: error: 'loff_t' has not been declared
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/base/linux_syscall_support.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/base/linux_syscall_support.h b/src/base/linux_syscall_support.h
index 85347a2..70431ca 100644
--- a/src/base/linux_syscall_support.h
+++ b/src/base/linux_syscall_support.h
@@ -162,6 +162,7 @@ extern "C" {
#include <unistd.h>
#include <linux/unistd.h>
#include <endian.h>
+#include <fcntl.h>
#ifdef __mips__
/* Include definitions of the ABI currently in use. */
--
2.13.3
@@ -2,22 +2,29 @@ SUMMARY = "Fast, multi-threaded malloc() and nifty performance analysis tools"
HOMEPAGE = "http://code.google.com/p/gperftools/" HOMEPAGE = "http://code.google.com/p/gperftools/"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://COPYING;md5=762732742c73dc6c7fbe8632f06c059a" LIC_FILES_CHKSUM = "file://COPYING;md5=762732742c73dc6c7fbe8632f06c059a"
DEPENDS = "libunwind" DEPENDS += "libunwind"
SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/gperftools/gperftools-2.5.tar.gz/aa1eaf95dbe2c9828d0bd3a00f770f50/gperftools-2.5.tar.gz \ SRCREV = "bf840dec0495e17f5c8403e68e10b9d6bf05c559"
SRC_URI = "git://github.com/gperftools/gperftools \
file://0001-Support-Atomic-ops-on-clang.patch \ file://0001-Support-Atomic-ops-on-clang.patch \
file://0001-Fix-build-failure-for-ppc.patch \
file://0001-Use-ucontext_t-instead-of-struct-ucontext.patch \ file://0001-Use-ucontext_t-instead-of-struct-ucontext.patch \
file://0001-fix-build-with-musl-libc.patch \
file://0001-include-fcntl.h-for-loff_t-definition.patch \
" "
SRC_URI[md5sum] = "aa1eaf95dbe2c9828d0bd3a00f770f50"
SRC_URI[sha256sum] = "6fa2748f1acdf44d750253e160cf6e2e72571329b42e563b455bde09e9e85173"
inherit autotools inherit autotools
S = "${WORKDIR}/git"
# On mips, we have the following error. # On mips, we have the following error.
# do_page_fault(): sending SIGSEGV to ls for invalid read access from 00000008 # do_page_fault(): sending SIGSEGV to ls for invalid read access from 00000008
# Segmentation fault (core dumped) # Segmentation fault (core dumped)
COMPATIBLE_HOST = "(i.86|x86_64|powerpc|powerpc64|arm|aarch64).*-linux*" COMPATIBLE_HOST = "(i.86|x86_64|powerpc|powerpc64|arm|aarch64).*-linux*"
# On aarch64, add this option to avoid system hanging when using libtcmalloc.so. # On aarch64, add this option to avoid system hanging when using libtcmalloc.so.
EXTRA_OECONF_aarch64 += "--disable-libunwind" EXTRA_OECONF_aarch64 += "--disable-libunwind"
# Disable thumb1
# {standard input}: Assembler messages:
# {standard input}:434: Error: lo register required -- `ldr pc,[sp]'
# Makefile:4538: recipe for target 'src/base/libtcmalloc_la-linuxthreads.lo' failed
ARM_INSTRUCTION_SET_armv5 = "arm"