mirror of
https://github.com/gperftools/gperftools
synced 2025-01-02 20:52:03 +00:00
Update cmake
This commit is contained in:
parent
913d3eb7d7
commit
6bbf2ed150
1516
CMakeLists.txt
1516
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
@ -1,34 +1,54 @@
|
||||
function(find_objcopy_with_weaken result objcopy_path)
|
||||
find_program(objcopy_exe "objcopy" PATHS ${objcopy_path})
|
||||
if(objcopy_exe)
|
||||
set(objcopy_found "found")
|
||||
function(find_objcopy_with_weaken)
|
||||
find_program(OBJCOPY_EXECUTABLE "objcopy")
|
||||
message(STATUS "Looking for objcopy that supports weaken - ${OBJCOPY_EXECUTABLE}")
|
||||
if(NOT OBJCOPY_EXECUTABLE)
|
||||
return()
|
||||
endif()
|
||||
set(objcopy_test_src "${CMAKE_CURRENT_BINARY_DIR}/objcopy_test.c")
|
||||
set(objcopy_test_exe "${CMAKE_CURRENT_BINARY_DIR}/objcopy_test")
|
||||
file(WRITE ${objcopy_test_src} "void foo() {} int main() { return 0; }")
|
||||
try_compile(objcopy_test_compiled
|
||||
${CMAKE_CURRENT_BINARY_DIR} ${objcopy_test_src}
|
||||
COPY_FILE ${objcopy_test_exe})
|
||||
if(objcopy_test_compiled AND EXISTS ${objcopy_test_exe})
|
||||
execute_process(
|
||||
COMMAND ${OBJCOPY_EXECUTABLE} -W foo ${objcopy_test_exe}
|
||||
RESULT_VARIABLE objcopy_result)
|
||||
file(REMOVE ${objcopy_test_exe})
|
||||
endif()
|
||||
if(objcopy_result EQUAL 0)
|
||||
set(objcopy_weaken ON)
|
||||
endif()
|
||||
file(REMOVE ${objcopy_test_src})
|
||||
if(objcopy_weaken)
|
||||
set(objcopy_has_weaken "Success")
|
||||
set(HAVE_OBJCOPY_WEAKEN TRUE PARENT_SCOPE)
|
||||
set(OBJCOPY_EXECUTABLE "${OBJCOPY_EXECUTABLE}" PARENT_SCOPE)
|
||||
else()
|
||||
set(objcopy_found "not found")
|
||||
endif()
|
||||
message(STATUS "Looking for objcopy that supports weaken - ${objcopy_found}")
|
||||
if(objcopy_exe)
|
||||
set(objcopy_test_src "${CMAKE_CURRENT_BINARY_DIR}/objcopy_test.c")
|
||||
set(objcopy_test_exe "${CMAKE_CURRENT_BINARY_DIR}/objcopy_test")
|
||||
file(WRITE ${objcopy_test_src} "void foo() {} int main() { return 0; }")
|
||||
try_compile(objcopy_test_compiled
|
||||
${CMAKE_CURRENT_BINARY_DIR} ${objcopy_test_src}
|
||||
COPY_FILE ${objcopy_test_exe})
|
||||
if(objcopy_test_compiled AND EXISTS ${objcopy_test_exe})
|
||||
execute_process(
|
||||
COMMAND ${objcopy_exe} -W foo ${objcopy_test_exe}
|
||||
RESULT_VARIABLE objcopy_result)
|
||||
file(REMOVE ${objcopy_test_exe})
|
||||
endif()
|
||||
if(objcopy_result EQUAL 0)
|
||||
set(objcopy_weaken ON)
|
||||
endif()
|
||||
file(REMOVE ${objcopy_test_src})
|
||||
if(objcopy_weaken)
|
||||
set(objcopy_has_weaken "Success")
|
||||
set(${result} objcopy_exe PARENT_SCOPE)
|
||||
else()
|
||||
set(objcopy_has_weaken "Failed")
|
||||
endif()
|
||||
message(STATUS "objcopy has weaken support - ${objcopy_has_weaken}")
|
||||
set(objcopy_has_weaken "Failed")
|
||||
endif()
|
||||
message(STATUS "objcopy has weaken support - ${objcopy_has_weaken}")
|
||||
endfunction(find_objcopy_with_weaken)
|
||||
|
||||
function(weaken_object target)
|
||||
if(NOT HAVE_OBJCOPY_WEAKEN)
|
||||
return()
|
||||
endif()
|
||||
# If we have objcopy, make malloc/free/etc weak symbols. That way folks
|
||||
# can override our malloc if they want to (they can still use tc_malloc).
|
||||
# Note: the weird-looking symbols are the c++ memory functions:
|
||||
# (in order) new, new(nothrow), new[], new[](nothrow), delete, delete[]
|
||||
# In theory this will break if mangling changes, but that seems pretty
|
||||
# unlikely at this point. Just in case, I throw in versions with an
|
||||
# extra underscore as well, which may help on OS X.
|
||||
add_custom_command(TARGET ${target} POST_BUILD
|
||||
COMMAND "${OBJCOPY_EXECUTABLE}"
|
||||
-W malloc -W free -W realloc -W calloc -W cfree
|
||||
-W memalign -W posix_memalign -W valloc -W pvalloc
|
||||
-W aligned_alloc
|
||||
-W malloc_stats -W mallopt -W mallinfo -W nallocx
|
||||
-W _Znwm -W _ZnwmRKSt9nothrow_t -W _Znam -W _ZnamRKSt9nothrow_t
|
||||
-W _ZdlPv -W _ZdaPv
|
||||
-W __Znwm -W __ZnwmRKSt9nothrow_t -W __Znam -W __ZnamRKSt9nothrow_t
|
||||
-W __ZdlPv -W __ZdaPv "$<TARGET_FILE:${target}>")
|
||||
endfunction()
|
@ -1,14 +0,0 @@
|
||||
function(gperftools_add_target target_name)
|
||||
if(inc)
|
||||
target_include_directories(${target_name} PUBLIC ${inc})
|
||||
endif()
|
||||
if(libs)
|
||||
target_link_libraries(${target_name} PUBLIC ${libs})
|
||||
endif()
|
||||
if(defs)
|
||||
target_compile_definitions(${target_name} PUBLIC ${defs})
|
||||
endif()
|
||||
if(options)
|
||||
target_compile_options(${target_name} PUBLIC ${options})
|
||||
endif()
|
||||
endfunction()
|
@ -1,160 +1,282 @@
|
||||
#ifndef GPERFTOOLS_CONFIG_H_
|
||||
/* Sometimes we accidentally #include this config.h instead of the one
|
||||
in .. -- this is particularly true for msys/mingw, which uses the
|
||||
unix config.h but also runs code in the windows directory.
|
||||
*/
|
||||
#ifdef __MINGW32__
|
||||
#include "../config.h"
|
||||
#define GOOGLE_PERFTOOLS_WINDOWS_CONFIG_H_
|
||||
#endif
|
||||
|
||||
#ifndef GOOGLE_PERFTOOLS_WINDOWS_CONFIG_H_
|
||||
#define GOOGLE_PERFTOOLS_WINDOWS_CONFIG_H_
|
||||
/* used by tcmalloc.h */
|
||||
#define GPERFTOOLS_CONFIG_H_
|
||||
|
||||
#cmakedefine HAVE_SNPRINTF
|
||||
/* Enable aggressive decommit by default */
|
||||
#cmakedefine ENABLE_AGGRESSIVE_DECOMMIT_BY_DEFAULT
|
||||
|
||||
/* Build new/delete operators for overaligned types */
|
||||
#cmakedefine ENABLE_ALIGNED_NEW_DELETE
|
||||
|
||||
/* Build runtime detection for sized delete */
|
||||
#cmakedefine ENABLE_DYNAMIC_SIZED_DELETE
|
||||
|
||||
/* Report large allocation */
|
||||
#cmakedefine ENABLE_LARGE_ALLOC_REPORT
|
||||
|
||||
/* Build sized deletion operators */
|
||||
#cmakedefine ENABLE_SIZED_DELETE
|
||||
|
||||
/* Define to 1 if you have the <asm/ptrace.h> header file. */
|
||||
#cmakedefine HAVE_ASM_PTRACE_H
|
||||
|
||||
/* Define to 1 if compiler supports __builtin_stack_pointer */
|
||||
#cmakedefine HAVE_BUILTIN_STACK_POINTER
|
||||
|
||||
/* Define to 1 if you have the <conflict-signal.h> header file. */
|
||||
#cmakedefine HAVE_CONFLICT_SIGNAL_H
|
||||
|
||||
/* Define to 1 if you have the <cygwin/signal.h> header file. */
|
||||
#cmakedefine HAVE_CYGWIN_SIGNAL_H
|
||||
|
||||
#cmakedefine01 HAVE_DECL_CFREE
|
||||
|
||||
#cmakedefine01 HAVE_DECL_MEMALIGN
|
||||
|
||||
#cmakedefine01 HAVE_DECL_POSIX_MEMALIGN
|
||||
|
||||
#cmakedefine01 HAVE_DECL_PVALLOC
|
||||
|
||||
#cmakedefine01 HAVE_DECL_UNAME
|
||||
|
||||
#cmakedefine01 HAVE_DECL_VALLOC
|
||||
|
||||
#cmakedefine HAVE_DLFCN_H
|
||||
|
||||
#cmakedefine HAVE_ELF32_VERSYM
|
||||
|
||||
#cmakedefine HAVE_EXECINFO_H
|
||||
|
||||
#cmakedefine HAVE_FCNTL_H
|
||||
|
||||
#cmakedefine HAVE_FEATURES_H
|
||||
|
||||
#cmakedefine HAVE_GETEUID
|
||||
|
||||
#cmakedefine HAVE_GETPAGESIZE
|
||||
|
||||
#cmakedefine HAVE_GLOB_H
|
||||
|
||||
#cmakedefine HAVE_GRP_H
|
||||
|
||||
#cmakedefine HAVE_INTTYPES_H
|
||||
|
||||
#cmakedefine01 HAVE_LIBUNWIND_H
|
||||
|
||||
#cmakedefine HAVE_LINUX_PTRACE_H
|
||||
|
||||
#cmakedefine HAVE_MALLOC_H
|
||||
|
||||
#cmakedefine HAVE_MALLOC_MALLOC_H
|
||||
|
||||
#cmakedefine HAVE_MEMORY_H
|
||||
|
||||
#cmakedefine HAVE_MMAP
|
||||
|
||||
#cmakedefine HAVE_NAMESPACES
|
||||
|
||||
#cmakedefine HAVE_POLL_H
|
||||
|
||||
#cmakedefine HAVE_PROGRAM_INVOCATION_NAME
|
||||
|
||||
#cmakedefine HAVE_PTHREAD
|
||||
|
||||
#cmakedefine HAVE_PWD_H
|
||||
|
||||
#cmakedefine HAVE_SBRK
|
||||
|
||||
#cmakedefine HAVE_FORK
|
||||
|
||||
#cmakedefine HAVE_SCHED_H
|
||||
|
||||
#cmakedefine HAVE_STDINT_H
|
||||
|
||||
#cmakedefine HAVE_STDLIB_H 1
|
||||
|
||||
#cmakedefine HAVE_STRINGS_H
|
||||
|
||||
#cmakedefine HAVE_STRING_H
|
||||
|
||||
#cmakedefine HAVE_STRUCT_MALLINFO
|
||||
|
||||
#cmakedefine HAVE_SYS_CDEFS_H
|
||||
|
||||
#cmakedefine HAVE_SYS_MALLOC_H
|
||||
|
||||
#cmakedefine HAVE_SYS_PARAM_H
|
||||
|
||||
#cmakedefine HAVE_SYS_PRCTL_H
|
||||
|
||||
#cmakedefine HAVE_SYS_RESOURCE_H
|
||||
|
||||
#cmakedefine HAVE_SYS_SOCKET_H
|
||||
|
||||
#cmakedefine HAVE_SYS_STAT_H
|
||||
|
||||
#cmakedefine HAVE_SYS_SYSCALL_H
|
||||
|
||||
#cmakedefine HAVE_SYS_TYPES_H
|
||||
|
||||
#cmakedefine HAVE_SYS_UCONTEXT_H
|
||||
|
||||
#cmakedefine HAVE_SYS_WAIT_H
|
||||
|
||||
#cmakedefine HAVE_TLS
|
||||
|
||||
#cmakedefine01 HAVE_DECL_SLEEP
|
||||
|
||||
#cmakedefine01 HAVE_DECL_NANOSLEEP
|
||||
|
||||
/* Define to 1 if you have the declaration of `backtrace', and to 0 if you
|
||||
don't. */
|
||||
#cmakedefine01 HAVE_DECL_BACKTRACE
|
||||
|
||||
#cmakedefine HAVE_UNWIND_BACKTRACE
|
||||
/* Define to 1 if you have the declaration of `cfree', and to 0 if you don't.
|
||||
*/
|
||||
#cmakedefine01 HAVE_DECL_CFREE
|
||||
|
||||
/* Define to 1 if you have the declaration of `memalign', and to 0 if you
|
||||
don't. */
|
||||
#cmakedefine01 HAVE_DECL_MEMALIGN
|
||||
|
||||
/* Define to 1 if you have the declaration of `nanosleep', and to 0 if you
|
||||
don't. */
|
||||
#cmakedefine01 HAVE_DECL_NANOSLEEP
|
||||
|
||||
/* Define to 1 if you have the declaration of `posix_memalign', and to 0 if
|
||||
you don't. */
|
||||
#cmakedefine01 HAVE_DECL_POSIX_MEMALIGN
|
||||
|
||||
/* Define to 1 if you have the declaration of `pvalloc', and to 0 if you
|
||||
don't. */
|
||||
#cmakedefine01 HAVE_DECL_PVALLOC
|
||||
|
||||
/* Define to 1 if you have the declaration of `sleep', and to 0 if you don't.
|
||||
*/
|
||||
#cmakedefine01 HAVE_DECL_SLEEP
|
||||
|
||||
/* Define to 1 if you have the declaration of `uname', and to 0 if you don't.
|
||||
*/
|
||||
#cmakedefine01 HAVE_DECL_UNAME
|
||||
|
||||
/* Define to 1 if you have the declaration of `valloc', and to 0 if you don't.
|
||||
*/
|
||||
#cmakedefine01 HAVE_DECL_VALLOC
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#cmakedefine HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if the system has the type `Elf32_Versym'. */
|
||||
#cmakedefine HAVE_ELF32_VERSYM
|
||||
|
||||
/* Define to 1 if you have the <execinfo.h> header file. */
|
||||
#cmakedefine HAVE_EXECINFO_H
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#cmakedefine HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the <features.h> header file. */
|
||||
#cmakedefine HAVE_FEATURES_H
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#cmakedefine HAVE_FORK
|
||||
|
||||
/* Define to 1 if you have the `geteuid' function. */
|
||||
#cmakedefine HAVE_GETEUID
|
||||
|
||||
/* Define to 1 if you have the <glob.h> header file. */
|
||||
#cmakedefine HAVE_GLOB_H
|
||||
|
||||
/* Define to 1 if you have the <grp.h> header file. */
|
||||
#cmakedefine HAVE_GRP_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <libunwind.h> header file. */
|
||||
#cmakedefine01 HAVE_LIBUNWIND_H
|
||||
|
||||
/* Define to 1 if you have the <linux/ptrace.h> header file. */
|
||||
#cmakedefine HAVE_LINUX_PTRACE_H
|
||||
|
||||
/* Define if this is Linux that has SIGEV_THREAD_ID */
|
||||
#cmakedefine01 HAVE_LINUX_SIGEV_THREAD_ID
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#cmakedefine HAVE_MALLOC_H
|
||||
|
||||
/* Define to 1 if you have the <malloc/malloc.h> header file. */
|
||||
#cmakedefine HAVE_MALLOC_MALLOC_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#cmakedefine HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have a working `mmap' system call. */
|
||||
#cmakedefine HAVE_MMAP
|
||||
|
||||
/* define if the compiler implements namespaces */
|
||||
#cmakedefine HAVE_NAMESPACES
|
||||
|
||||
/* Define to 1 if you have the <poll.h> header file. */
|
||||
#cmakedefine HAVE_POLL_H
|
||||
|
||||
/* define if libc has program_invocation_name */
|
||||
#cmakedefine HAVE_PROGRAM_INVOCATION_NAME
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#cmakedefine HAVE_PTHREAD
|
||||
|
||||
/* defined to 1 if pthread symbols are exposed even without include pthread.h
|
||||
*/
|
||||
#cmakedefine HAVE_PTHREAD_DESPITE_ASKING_FOR
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
#cmakedefine HAVE_PWD_H
|
||||
|
||||
/* Define to 1 if you have the `sbrk' function. */
|
||||
#cmakedefine HAVE_SBRK
|
||||
|
||||
/* Define to 1 if you have the <sched.h> header file. */
|
||||
#cmakedefine HAVE_SCHED_H
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#cmakedefine HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#cmakedefine HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#cmakedefine HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#cmakedefine HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#cmakedefine HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if the system has the type `struct mallinfo'. */
|
||||
#cmakedefine HAVE_STRUCT_MALLINFO
|
||||
|
||||
/* Define to 1 if you have the <sys/cdefs.h> header file. */
|
||||
#cmakedefine HAVE_SYS_CDEFS_H
|
||||
|
||||
/* Define to 1 if you have the <sys/malloc.h> header file. */
|
||||
#cmakedefine HAVE_SYS_MALLOC_H
|
||||
|
||||
/* Define to 1 if you have the <sys/prctl.h> header file. */
|
||||
#cmakedefine HAVE_SYS_PRCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||
#cmakedefine HAVE_SYS_RESOURCE_H
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#cmakedefine HAVE_SYS_SOCKET_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#cmakedefine HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/syscall.h> header file. */
|
||||
#cmakedefine HAVE_SYS_SYSCALL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#cmakedefine HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ucontext.h> header file. */
|
||||
#cmakedefine HAVE_SYS_UCONTEXT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/wait.h> header file. */
|
||||
#cmakedefine HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define to 1 if compiler supports __thread */
|
||||
#cmakedefine HAVE_TLS
|
||||
|
||||
/* Define to 1 if you have the <ucontext.h> header file. */
|
||||
#cmakedefine HAVE_UCONTEXT_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#cmakedefine HAVE_UNISTD_H
|
||||
|
||||
/* Whether <unwind.h> contains _Unwind_Backtrace */
|
||||
#cmakedefine HAVE_UNWIND_BACKTRACE
|
||||
|
||||
/* Define to 1 if you have the <unwind.h> header file. */
|
||||
#cmakedefine HAVE_UNWIND_H
|
||||
|
||||
/* Define to 1 if you have the <valgrind.h> header file. */
|
||||
#cmakedefine HAVE_VALGRIND_H
|
||||
|
||||
/* define if your compiler has __attribute__ */
|
||||
#cmakedefine HAVE___ATTRIBUTE__
|
||||
|
||||
/* define if your compiler supports alignment of functions */
|
||||
#cmakedefine HAVE___ATTRIBUTE__ALIGNED_FN
|
||||
|
||||
/* Define to 1 if compiler supports __environ */
|
||||
#cmakedefine HAVE___ENVIRON
|
||||
|
||||
/* Define to 1 if the system has the type `__int64'. */
|
||||
#cmakedefine HAVE___INT64
|
||||
|
||||
/* Define to 1 if you have the `__sbrk' function. */
|
||||
#cmakedefine HAVE___SBRK
|
||||
|
||||
/* prefix where we look for installed files */
|
||||
#cmakedefine INSTALL_PREFIX
|
||||
|
||||
/* Define to 1 if int32_t is equivalent to intptr_t */
|
||||
#cmakedefine INT32_EQUALS_INTPTR
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#cmakedefine LT_OBJDIR
|
||||
|
||||
#cmakedefine MALLOC_HOOK_MAYBE_VOLATILE
|
||||
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "@PROJECT_NAME@"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "gperftools@googlegroups.com"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "@PROJECT_NAME@"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "@PROJECT_NAME@ @PROJECT_VERSION@"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "@PROJECT_NAME@"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#cmakedefine PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "@PROJECT_VERSION@"
|
||||
|
||||
/* How to access the PC from a struct ucontext */
|
||||
#define PC_FROM_UCONTEXT @PC_FROM_UCONTEXT_DEF@
|
||||
|
||||
/* Always the empty-string on non-windows systems. On windows, should be
|
||||
"__declspec(dllexport)". This way, when we compile the dll, we export our
|
||||
functions/classes. It's safe to define this here because config.h is only
|
||||
used internally, to compile the DLL, and every DLL source file #includes
|
||||
"config.h" before anything else. */
|
||||
#ifndef WIN32
|
||||
#cmakedefine WIN32
|
||||
#endif
|
||||
#if defined(WIN32)
|
||||
#ifndef PERFTOOLS_DLL_DECL
|
||||
# define PERFTOOLS_IS_A_DLL 1 # define PERFTOOLS_DLL_DECL __declspec(dllexport)
|
||||
# define PERFTOOLS_IS_A_DLL 1
|
||||
# define PERFTOOLS_DLL_DECL __declspec(dllexport)
|
||||
# define PERFTOOLS_DLL_DECL_FOR_UNITTESTS __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
@ -164,44 +286,68 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define PRIdS "Id"
|
||||
/* printf format code for printing a size_t and ssize_t */
|
||||
#define PRIdS "zd"
|
||||
|
||||
#define PRIuS "Iu"
|
||||
/* printf format code for printing a size_t and ssize_t */
|
||||
#define PRIuS "zu"
|
||||
|
||||
#define PRIxS "Ix"
|
||||
/* printf format code for printing a size_t and ssize_t */
|
||||
#define PRIxS "zx"
|
||||
|
||||
#cmakedefine PTHREADS_CRASHES_IF_RUN_TOO_EARLY
|
||||
/* Mark the systems where we know it's bad if pthreads runs too
|
||||
early before main (before threads are initialized, presumably). */
|
||||
#ifdef __FreeBSD__
|
||||
#define PTHREADS_CRASHES_IF_RUN_TOO_EARLY 1
|
||||
#endif
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
#define PTHREAD_CREATE_JOINABLE @PTHREAD_CREATE_JOINABLE@
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* the namespace where STL code like vector<> is defined */
|
||||
#define STL_NAMESPACE @STL_NAMESPACE@
|
||||
|
||||
/* Define 8 bytes of allocation alignment for tcmalloc */
|
||||
#cmakedefine TCMALLOC_ALIGN_8BYTES
|
||||
|
||||
/* Define internal page size for tcmalloc as number of left bitshift */
|
||||
#cmakedefine TCMALLOC_PAGE_SIZE_SHIFT
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION @PROJECT_VERSION@
|
||||
|
||||
/* C99 says: define this to get the PRI... macros from stdint.h */
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
# define __STDC_FORMAT_MACROS 1
|
||||
#endif
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#define inline @inline@
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Extra stuff not found in config.h.in
|
||||
#if defined(WIN32)
|
||||
|
||||
// This must be defined before the windows.h is included. We need at
|
||||
// least 0x0400 for mutex.h to have access to TryLock, and at least
|
||||
// 0x0501 for patch_functions.cc to have access to GetModuleHandleEx.
|
||||
// (This latter is an optimization we could take out if need be.)
|
||||
#ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
|
||||
// We want to make sure not to ever try to #include heap-checker.h
|
||||
#define NO_HEAP_CHECK 1
|
||||
|
||||
// TODO(csilvers): include windows/port.h in every relevant source file instead?
|
||||
#include "windows/port.h"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include "windows/mingw.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* GOOGLE_PERFTOOLS_WINDOWS_CONFIG_H_ */
|
||||
|
14
cmake/pkgconfig.pc
Normal file
14
cmake/pkgconfig.pc
Normal file
@ -0,0 +1,14 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
|
||||
Name: @CMAKE_PROJECT_NAME@
|
||||
Version: @CMAKE_PROJECT_VERSION@
|
||||
Description: @CMAKE_PROJECT_DESCRIPTION@
|
||||
URL: @CMAKE_PROJECT_HOMEPAGE_URL@
|
||||
Requires:
|
||||
Libs: -L${libdir} -l@NAME@
|
||||
Libs.private:@PTHREAD_FLAGS@
|
||||
Cflags: -I${includedir}
|
||||
|
@ -37,6 +37,9 @@
|
||||
#define TCMALLOC_TCMALLOC_H_
|
||||
|
||||
#include <stddef.h> /* for size_t */
|
||||
#ifdef __cplusplus
|
||||
#include <new> /* for std::nothrow_t, std::align_val_t */
|
||||
#endif
|
||||
|
||||
/* Define the version number so folks can check against it */
|
||||
#define TC_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
@ -45,7 +48,7 @@
|
||||
#define TC_VERSION_STRING "gperftools @PROJECT_VERSION@"
|
||||
|
||||
/* For struct mallinfo, if it's defined. */
|
||||
#ifdef HAVE_STRUCT_MALLINFO
|
||||
#if @HAVE_STRUCT_MALLINFO@
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
@ -74,10 +77,6 @@
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace std {
|
||||
struct nothrow_t;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
@ -105,7 +104,7 @@ extern "C" {
|
||||
|
||||
PERFTOOLS_DLL_DECL void tc_malloc_stats(void) PERFTOOLS_NOTHROW;
|
||||
PERFTOOLS_DLL_DECL int tc_mallopt(int cmd, int value) PERFTOOLS_NOTHROW;
|
||||
#if HAVE_STRUCT_MALLINFO
|
||||
#if @HAVE_STRUCT_MALLINFO@
|
||||
PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) PERFTOOLS_NOTHROW;
|
||||
#endif
|
||||
|
||||
@ -134,6 +133,23 @@ extern "C" {
|
||||
PERFTOOLS_DLL_DECL void tc_deletearray_sized(void* p, size_t size) PERFTOOLS_NOTHROW;
|
||||
PERFTOOLS_DLL_DECL void tc_deletearray_nothrow(void* p,
|
||||
const std::nothrow_t&) PERFTOOLS_NOTHROW;
|
||||
|
||||
#if @HAVE_STD_ALIGN_VAL_T@ && __cplusplus >= 201703L
|
||||
PERFTOOLS_DLL_DECL void* tc_new_aligned(size_t size, std::align_val_t al);
|
||||
PERFTOOLS_DLL_DECL void* tc_new_aligned_nothrow(size_t size, std::align_val_t al,
|
||||
const std::nothrow_t&) PERFTOOLS_NOTHROW;
|
||||
PERFTOOLS_DLL_DECL void tc_delete_aligned(void* p, std::align_val_t al) PERFTOOLS_NOTHROW;
|
||||
PERFTOOLS_DLL_DECL void tc_delete_sized_aligned(void* p, size_t size, std::align_val_t al) PERFTOOLS_NOTHROW;
|
||||
PERFTOOLS_DLL_DECL void tc_delete_aligned_nothrow(void* p, std::align_val_t al,
|
||||
const std::nothrow_t&) PERFTOOLS_NOTHROW;
|
||||
PERFTOOLS_DLL_DECL void* tc_newarray_aligned(size_t size, std::align_val_t al);
|
||||
PERFTOOLS_DLL_DECL void* tc_newarray_aligned_nothrow(size_t size, std::align_val_t al,
|
||||
const std::nothrow_t&) PERFTOOLS_NOTHROW;
|
||||
PERFTOOLS_DLL_DECL void tc_deletearray_aligned(void* p, std::align_val_t al) PERFTOOLS_NOTHROW;
|
||||
PERFTOOLS_DLL_DECL void tc_deletearray_sized_aligned(void* p, size_t size, std::align_val_t al) PERFTOOLS_NOTHROW;
|
||||
PERFTOOLS_DLL_DECL void tc_deletearray_aligned_nothrow(void* p, std::align_val_t al,
|
||||
const std::nothrow_t&) PERFTOOLS_NOTHROW;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <stdlib.h> // for rand()
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <random>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include "addressmap-inl.h"
|
||||
@ -47,7 +48,7 @@ using std::pair;
|
||||
using std::make_pair;
|
||||
using std::vector;
|
||||
using std::set;
|
||||
using std::random_shuffle;
|
||||
using std::shuffle;
|
||||
|
||||
struct UniformRandomNumberGenerator {
|
||||
size_t Uniform(size_t max_size) {
|
||||
@ -91,7 +92,9 @@ int main(int argc, char** argv) {
|
||||
RAW_LOG(INFO, "Iteration %d/%d...\n", x, FLAGS_iters);
|
||||
|
||||
// Permute pointers to get rid of allocation order issues
|
||||
random_shuffle(ptrs_and_sizes.begin(), ptrs_and_sizes.end());
|
||||
std::random_device rd;
|
||||
std::mt19937 g(rd());
|
||||
shuffle(ptrs_and_sizes.begin(), ptrs_and_sizes.end(), g);
|
||||
|
||||
AddressMap<ValueT> map(malloc, free);
|
||||
const ValueT* result;
|
||||
|
10
src/windows/CMakeLists.txt
Normal file
10
src/windows/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
add_executable(addr2line-pdb addr2line-pdb.c)
|
||||
target_link_libraries(addr2line-pdb dbghelp)
|
||||
|
||||
add_executable(nm-pdb nm-pdb.c)
|
||||
target_link_libraries(nm-pdb dbghelp)
|
||||
|
||||
#enable_language(ASM)
|
||||
#add_executable(preamble_patcher_test preamble_patcher_test.cc shortproc.asm)
|
||||
#target_link_libraries(preamble_patcher_test tcmalloc_minimal)
|
||||
#add_test(preamble_patcher_test preamble_patcher_test)
|
Loading…
Reference in New Issue
Block a user