diff --git a/devel/google-perftools/Makefile b/devel/google-perftools/Makefile index 0c0ebbb68dba..f8b0d79c6900 100644 --- a/devel/google-perftools/Makefile +++ b/devel/google-perftools/Makefile @@ -1,78 +1,78 @@ # Created by: Yuri Victorovich PORTNAME= google-perftools DISTVERSIONPREFIX= gperftools- DISTVERSION= 2.9.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= https://github.com/gperftools/gperftools/releases/download/gperftools-${PORTVERSION}/ DISTNAME= gperftools-${PORTVERSION} MAINTAINER= yuri@FreeBSD.org COMMENT= Fast, multi-threaded malloc() and nifty performance analysis tools LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/COPYING BROKEN_aarch64= fails to compile: src/stacktrace.cc:230:2: Cannot calculate stack trace: will need to write for your environment BROKEN_riscv64= fails to compile: src/base/basictypes.h:387:5: Could not determine cache line length - unknown architecture USES= compiler:c11 gmake libtool GNU_CONFIGURE= yes USE_LDCONFIG= yes TEST_TARGET= check LIBS+= -lexecinfo DOCSDIR= ${PREFIX}/share/doc/gperftools OPTIONS_DEFINE= DOCS OPTIONS_SINGLE= PAGESIZE ALIGN OPTIONS_SINGLE_ALIGN= ALIGN8 ALIGN16 OPTIONS_SINGLE_PAGESIZE= PAGE8K PAGE32K PAGE64K OPTIONS_DEFAULT= PAGE8K ALIGN16 ALIGN_DESC= The tcmalloc allocation alignment ALIGN8_DESC= 8 bytes allocation alignment ALIGN16_DESC= 16 bytes allocation alignment PAGESIZE_DESC= The tcmalloc internal page size PAGE8K_DESC= 8K page size PAGE32K_DESC= 32K page size PAGE64K_DESC= 64K page size ALIGN8_CONFIGURE_ON= --with-tcmalloc-alignment=8 ALIGN16_CONFIGURE_ON= --with-tcmalloc-alignment=16 PAGE8K_CONFIGURE_ON= --with-tcmalloc-pagesize=8 PAGE32K_CONFIGURE_ON= --with-tcmalloc-pagesize=32 PAGE64K_CONFIGURE_ON= --with-tcmalloc-pagesize=64 PORTDOCS= * .include .if ${COMPILER_TYPE} == "clang" && !defined(USE_GCC) # clang cannot disable builtins individually CXXFLAGS+= -fno-builtin .endif .if ${ARCH} == "amd64" CONFIGURE_ARGS+=--enable-frame-pointers .endif # keep in sync with all platforms where libunwind is available .if ${ARCH} == aarch64 || ${ARCH} == amd64 || ${ARCH} == armv7 || ${ARCH} == i386 || ${ARCH} == powerpc64 || ${ARCH} == powerpc64le LIB_DEPENDS+= libunwind.so:devel/libunwind .endif post-build: @${ECHO} @${ECHO} "Please run 'make check' (requires bash)." @${ECHO} "Two testcases are known to fail. Testsuite is known to be" @${ECHO} "unreliable and give false positives and negatives (PR#661)." @${ECHO} post-install: ${MV} ${STAGEDIR}${PREFIX}/bin/pprof ${STAGEDIR}${PREFIX}/bin/perftools-pprof @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/lib*.so.* .include diff --git a/devel/google-perftools/files/patch-src_base_dynamic__annotations.c b/devel/google-perftools/files/patch-src_base_dynamic__annotations.c new file mode 100644 index 000000000000..e02b1a5f5afe --- /dev/null +++ b/devel/google-perftools/files/patch-src_base_dynamic__annotations.c @@ -0,0 +1,37 @@ +- add another way to determine if the process is run under valgrind - based on LD_PRELOAD patterns presence +- Submitted: https://github.com/gperftools/gperftools/pull/1316 + +--- src/base/dynamic_annotations.c.orig 2021-02-15 06:44:21 UTC ++++ src/base/dynamic_annotations.c +@@ -43,6 +43,19 @@ + #include "base/dynamic_annotations.h" + #include "getenv_safe.h" // for TCMallocGetenvSafe + ++static int running_on_valgrind_preload = -1; ++void __attribute__ ((constructor)) premain() { ++ char *LD_PRELOAD = getenv("LD_PRELOAD"); ++ running_on_valgrind_preload = LD_PRELOAD != NULL && ++ ( ++ strstr(LD_PRELOAD, "/valgrind/") != NULL ++ || ++ strstr(LD_PRELOAD, "/vgpreload") != NULL ++ ) ++ ? ++ 1 : 0; ++} ++ + static int GetRunningOnValgrind(void) { + #ifdef RUNNING_ON_VALGRIND + if (RUNNING_ON_VALGRIND) return 1; +@@ -51,6 +64,11 @@ static int GetRunningOnValgrind(void) { + if (running_on_valgrind_str) { + return strcmp(running_on_valgrind_str, "0") != 0; + } ++ ++ // use the LD_PRELOAD trick from https://stackoverflow.com/questions/365458/how-can-i-detect-if-a-program-is-running-from-within-valgrind ++ if (running_on_valgrind_preload == 1) ++ return 1; ++ + return 0; + } +