diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index c05cbb09..b48819ea 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -11,7 +11,7 @@ config("base") { "-Werror", ] - cflags_cc = [ "-std=c++14" ] + cflags_cc = [ "-std=c++17" ] include_dirs = [ "//src", @@ -23,10 +23,12 @@ config("default_library") { cflags = [ "-fPIC" ] cflags_cc = [ - "-std=c++14", + "-std=c++17", "-nostdinc++", ] + defines = [ "_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS" ] + include_dirs = [ "//src/third_party/libcxx/exported/include" ] ldflags = [ "-nodefaultlibs" ] diff --git a/build/config/linux/BUILD.gn b/build/config/linux/BUILD.gn index bdf213a9..3362d2a0 100644 --- a/build/config/linux/BUILD.gn +++ b/build/config/linux/BUILD.gn @@ -2,7 +2,7 @@ config("base") { defines = [ "OS_LINUX" ] ldflags = [ - "-fuse-ld=gold", + "-fuse-ld=lld", "-rdynamic", # for |backtrace()| "-rpath", "\$ORIGIN", diff --git a/src/third_party/gperftools/BUILD.gn b/src/third_party/gperftools/BUILD.gn index 05fa7ce9..36a6c086 100644 --- a/src/third_party/gperftools/BUILD.gn +++ b/src/third_party/gperftools/BUILD.gn @@ -143,6 +143,7 @@ source_set("tcmalloc_internal") { "exported/src/base/low_level_alloc.cc", "exported/src/central_freelist.cc", "exported/src/common.cc", + "exported/src/emergency_malloc_for_stacktrace.cc", "exported/src/heap-profile-table.cc", "exported/src/heap-profiler.cc", "exported/src/internal_logging.cc", diff --git a/src/third_party/gperftools/exported b/src/third_party/gperftools/exported index 54505f1d..9608fa3b 160000 --- a/src/third_party/gperftools/exported +++ b/src/third_party/gperftools/exported @@ -1 +1 @@ -Subproject commit 54505f1d50c2d1f4676f5e87090b64a117fd980e +Subproject commit 9608fa3bcf8020d35f59fbf70cd3cbe4b015b972 diff --git a/src/third_party/gperftools/linux/config.h b/src/third_party/gperftools/linux/config.h index 550c5bfc..bada8b13 100644 --- a/src/third_party/gperftools/linux/config.h +++ b/src/third_party/gperftools/linux/config.h @@ -6,6 +6,15 @@ #define GPERFTOOLS_CONFIG_H_ +/* Build new/delete operators for overaligned types */ +#define ENABLE_ALIGNED_NEW_DELETE 1 + +/* Build runtime detection for sized delete */ +/* #undef ENABLE_DYNAMIC_SIZED_DELETE */ + +/* Build sized deletion operators */ +/* #undef ENABLE_SIZED_DELETE */ + /* Define to 1 if compiler supports __builtin_expect */ #define HAVE_BUILTIN_EXPECT 1 @@ -24,7 +33,7 @@ /* Define to 1 if you have the declaration of `cfree', and to 0 if you don't. */ -#define HAVE_DECL_CFREE 1 +#define HAVE_DECL_CFREE 0 /* Define to 1 if you have the declaration of `memalign', and to 0 if you don't. */ @@ -93,12 +102,12 @@ /* Define to 1 if you have the header file. */ #define HAVE_LINUX_PTRACE_H 1 +/* Define if this is Linux that has SIGEV_THREAD_ID */ +#define HAVE_LINUX_SIGEV_THREAD_ID 1 + /* Define to 1 if you have the header file. */ #define HAVE_MALLOC_H 1 -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MALLOC_MALLOC_H */ - /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 @@ -148,9 +157,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_CDEFS_H 1 -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_MALLOC_H */ - /* Define to 1 if you have the header file. */ #define HAVE_SYS_PARAM_H 1 @@ -172,7 +178,7 @@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 -/* is broken on redhat 7 */ +/* Define to 1 if you have the header file. */ #define HAVE_SYS_UCONTEXT_H 1 /* Define to 1 if you have the header file. */ @@ -187,6 +193,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 +/* Whether contains _Unwind_Backtrace */ +#define HAVE_UNWIND_BACKTRACE 1 + /* Define to 1 if you have the header file. */ #define HAVE_UNWIND_H 1 @@ -196,6 +205,9 @@ /* define if your compiler has __attribute__ */ #define HAVE___ATTRIBUTE__ 1 +/* define if your compiler supports alignment of functions */ +#define HAVE___ATTRIBUTE__ALIGNED_FN 1 + /* Define to 1 if compiler supports __environ */ #define HAVE___ENVIRON 1 @@ -208,27 +220,20 @@ /* Define to 1 if int32_t is equivalent to intptr_t */ /* #undef INT32_EQUALS_INTPTR */ -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ +/* Define to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" -/* Define to 'volatile' if __malloc_hook is declared volatile */ -#define MALLOC_HOOK_MAYBE_VOLATILE volatile - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - /* Name of package */ #define PACKAGE "gperftools" /* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "google-perftools@googlegroups.com" +#define PACKAGE_BUGREPORT "gperftools@googlegroups.com" /* Define to the full name of this package. */ #define PACKAGE_NAME "gperftools" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "gperftools 2.2.1" +#define PACKAGE_STRING "gperftools 2.7" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "gperftools" @@ -237,7 +242,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "2.2.1" +#define PACKAGE_VERSION "2.7" /* How to access the PC from a struct ucontext */ #define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP] @@ -269,13 +274,22 @@ /* #undef PTHREAD_CREATE_JOINABLE */ /* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 +/* #undef STDC_HEADERS */ /* the namespace where STL code like vector<> is defined */ #define STL_NAMESPACE std +/* Define 32K of internal pages size for tcmalloc */ +/* #undef TCMALLOC_32K_PAGES */ + +/* Define 64K of internal pages size for tcmalloc */ +/* #undef TCMALLOC_64K_PAGES */ + +/* Define 8 bytes of allocation alignment for tcmalloc */ +/* #undef TCMALLOC_ALIGN_8BYTES */ + /* Version number of package */ -#define VERSION "2.2.1" +#define VERSION "2.7" /* C99 says: define this to get the PRI... macros from stdint.h */ #ifndef __STDC_FORMAT_MACROS diff --git a/src/third_party/gperftools/linux/gperftools/tcmalloc.h b/src/third_party/gperftools/linux/gperftools/tcmalloc.h index 3d1e7b09..79350817 100644 --- a/src/third_party/gperftools/linux/gperftools/tcmalloc.h +++ b/src/third_party/gperftools/linux/gperftools/tcmalloc.h @@ -1,11 +1,11 @@ -// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- +// -*- Mode: C; c-basic-offset: 2; indent-tabs-mode: nil -*- /* Copyright (c) 2003, Google Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -15,7 +15,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -36,37 +36,38 @@ #ifndef TCMALLOC_TCMALLOC_H_ #define TCMALLOC_TCMALLOC_H_ -#include // for size_t -#ifdef HAVE_SYS_CDEFS_H -#include // where glibc defines __THROW -#endif - -// __THROW is defined in glibc systems. It means, counter-intuitively, -// "This function will never throw an exception." It's an optional -// optimization tool, but we may need to use it to match glibc prototypes. -#ifndef __THROW /* I guess we're not on a glibc system */ -# define __THROW /* __THROW is just an optimization, so ok to make it "" */ +#include /* for size_t */ +#ifdef __cplusplus +#include /* for std::nothrow_t, std::align_val_t */ #endif -// Define the version number so folks can check against it +/* Define the version number so folks can check against it */ #define TC_VERSION_MAJOR 2 -#define TC_VERSION_MINOR 2 -#define TC_VERSION_PATCH ".1" -#define TC_VERSION_STRING "gperftools 2.2.1" - -// For struct mallinfo, if it's defined. -#ifdef HAVE_STRUCT_MALLINFO -// Malloc can be in several places on older versions of OS X. -# if defined(HAVE_MALLOC_H) +#define TC_VERSION_MINOR 7 +#define TC_VERSION_PATCH "" +#define TC_VERSION_STRING "gperftools 2.7" + +/* For struct mallinfo, if it's defined. */ +#if 1 # include -# elif defined(HAVE_SYS_MALLOC_H) -# include -# elif defined(HAVE_MALLOC_MALLOC_H) -# include +#endif + +#ifndef PERFTOOLS_NOTHROW + +#if __cplusplus >= 201103L +#define PERFTOOLS_NOTHROW noexcept +#elif defined(__cplusplus) +#define PERFTOOLS_NOTHROW throw() +#else +# ifdef __GNUC__ +# define PERFTOOLS_NOTHROW __attribute__((__nothrow__)) +# else +# define PERFTOOLS_NOTHROW # endif #endif -// Annoying stuff for windows -- makes sure clients can import these functions +#endif + #ifndef PERFTOOLS_DLL_DECL # ifdef _WIN32 # define PERFTOOLS_DLL_DECL __declspec(dllimport) @@ -76,60 +77,87 @@ #endif #ifdef __cplusplus -namespace std { -struct nothrow_t; -} - extern "C" { #endif - // Returns a human-readable version string. If major, minor, - // and/or patch are not NULL, they are set to the major version, - // minor version, and patch-code (a string, usually ""). + /* + * Returns a human-readable version string. If major, minor, + * and/or patch are not NULL, they are set to the major version, + * minor version, and patch-code (a string, usually ""). + */ PERFTOOLS_DLL_DECL const char* tc_version(int* major, int* minor, - const char** patch) __THROW; + const char** patch) PERFTOOLS_NOTHROW; - PERFTOOLS_DLL_DECL void* tc_malloc(size_t size) __THROW; - PERFTOOLS_DLL_DECL void* tc_malloc_skip_new_handler(size_t size) __THROW; - PERFTOOLS_DLL_DECL void tc_free(void* ptr) __THROW; - PERFTOOLS_DLL_DECL void* tc_realloc(void* ptr, size_t size) __THROW; - PERFTOOLS_DLL_DECL void* tc_calloc(size_t nmemb, size_t size) __THROW; - PERFTOOLS_DLL_DECL void tc_cfree(void* ptr) __THROW; + PERFTOOLS_DLL_DECL void* tc_malloc(size_t size) PERFTOOLS_NOTHROW; + PERFTOOLS_DLL_DECL void* tc_malloc_skip_new_handler(size_t size) PERFTOOLS_NOTHROW; + PERFTOOLS_DLL_DECL void tc_free(void* ptr) PERFTOOLS_NOTHROW; + PERFTOOLS_DLL_DECL void tc_free_sized(void *ptr, size_t size) PERFTOOLS_NOTHROW; + PERFTOOLS_DLL_DECL void* tc_realloc(void* ptr, size_t size) PERFTOOLS_NOTHROW; + PERFTOOLS_DLL_DECL void* tc_calloc(size_t nmemb, size_t size) PERFTOOLS_NOTHROW; + PERFTOOLS_DLL_DECL void tc_cfree(void* ptr) PERFTOOLS_NOTHROW; PERFTOOLS_DLL_DECL void* tc_memalign(size_t __alignment, - size_t __size) __THROW; + size_t __size) PERFTOOLS_NOTHROW; PERFTOOLS_DLL_DECL int tc_posix_memalign(void** ptr, - size_t align, size_t size) __THROW; - PERFTOOLS_DLL_DECL void* tc_valloc(size_t __size) __THROW; - PERFTOOLS_DLL_DECL void* tc_pvalloc(size_t __size) __THROW; + size_t align, size_t size) PERFTOOLS_NOTHROW; + PERFTOOLS_DLL_DECL void* tc_valloc(size_t __size) PERFTOOLS_NOTHROW; + PERFTOOLS_DLL_DECL void* tc_pvalloc(size_t __size) PERFTOOLS_NOTHROW; - PERFTOOLS_DLL_DECL void tc_malloc_stats(void) __THROW; - PERFTOOLS_DLL_DECL int tc_mallopt(int cmd, int value) __THROW; + PERFTOOLS_DLL_DECL void tc_malloc_stats(void) PERFTOOLS_NOTHROW; + PERFTOOLS_DLL_DECL int tc_mallopt(int cmd, int value) PERFTOOLS_NOTHROW; #if 1 - PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) __THROW; + PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) PERFTOOLS_NOTHROW; #endif - // This is an alias for MallocExtension::instance()->GetAllocatedSize(). - // It is equivalent to - // OS X: malloc_size() - // glibc: malloc_usable_size() - // Windows: _msize() - PERFTOOLS_DLL_DECL size_t tc_malloc_size(void* ptr) __THROW; + /* + * This is an alias for MallocExtension::instance()->GetAllocatedSize(). + * It is equivalent to + * OS X: malloc_size() + * glibc: malloc_usable_size() + * Windows: _msize() + */ + PERFTOOLS_DLL_DECL size_t tc_malloc_size(void* ptr) PERFTOOLS_NOTHROW; #ifdef __cplusplus - PERFTOOLS_DLL_DECL int tc_set_new_mode(int flag) __THROW; + PERFTOOLS_DLL_DECL int tc_set_new_mode(int flag) PERFTOOLS_NOTHROW; PERFTOOLS_DLL_DECL void* tc_new(size_t size); PERFTOOLS_DLL_DECL void* tc_new_nothrow(size_t size, - const std::nothrow_t&) __THROW; - PERFTOOLS_DLL_DECL void tc_delete(void* p) __THROW; + const std::nothrow_t&) PERFTOOLS_NOTHROW; + PERFTOOLS_DLL_DECL void tc_delete(void* p) PERFTOOLS_NOTHROW; + PERFTOOLS_DLL_DECL void tc_delete_sized(void* p, size_t size) PERFTOOLS_NOTHROW; PERFTOOLS_DLL_DECL void tc_delete_nothrow(void* p, - const std::nothrow_t&) __THROW; + const std::nothrow_t&) PERFTOOLS_NOTHROW; PERFTOOLS_DLL_DECL void* tc_newarray(size_t size); PERFTOOLS_DLL_DECL void* tc_newarray_nothrow(size_t size, - const std::nothrow_t&) __THROW; - PERFTOOLS_DLL_DECL void tc_deletearray(void* p) __THROW; + const std::nothrow_t&) PERFTOOLS_NOTHROW; + PERFTOOLS_DLL_DECL void tc_deletearray(void* p) PERFTOOLS_NOTHROW; + 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&) __THROW; + const std::nothrow_t&) PERFTOOLS_NOTHROW; + +#if 1 && __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 -#endif // #ifndef TCMALLOC_TCMALLOC_H_ +/* We're only un-defining for public */ +#if !defined(GPERFTOOLS_CONFIG_H_) + +#undef PERFTOOLS_NOTHROW + +#endif /* GPERFTOOLS_CONFIG_H_ */ + +#endif /* #ifndef TCMALLOC_TCMALLOC_H_ */ diff --git a/src/third_party/libcxx/BUILD.gn b/src/third_party/libcxx/BUILD.gn index 9b767b36..c02c1811 100644 --- a/src/third_party/libcxx/BUILD.gn +++ b/src/third_party/libcxx/BUILD.gn @@ -21,7 +21,11 @@ config("flags") { cflags += [ "-fno-ms-compatibility" ] } - defines = [ "LIBCXX_BUILDING_LIBCXXABI", "_LIBCPP_BUILDING_LIBRARY" ] + defines = [ + "LIBCXX_BUILDING_LIBCXXABI", + "_LIBCPP_BUILDING_LIBRARY", + "_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS", + ] if (host_os == "win") { defines += [ "_HAS_CHAR16_T_LANGUAGE_SUPPORT" ] } diff --git a/src/third_party/libcxxabi/BUILD.gn b/src/third_party/libcxxabi/BUILD.gn index 1eccc9b7..3c906114 100644 --- a/src/third_party/libcxxabi/BUILD.gn +++ b/src/third_party/libcxxabi/BUILD.gn @@ -19,14 +19,6 @@ config("flags") { "__STDC_LIMIT_MACROS", ] - if (host_os == "linux") { - defines += [ - # TODO(matthewtff): Remove this define once libcxxabi updated to have own - # implementation of __cxa_thread_atexit_impl - "HAVE___CXA_THREAD_ATEXIT_IMPL", - ] - } - cflags = [ "-fdata-sections", "-ffunction-sections", @@ -61,7 +53,7 @@ config("flags") { "-Wwrite-strings", "-Wno-error", ] - + if (host_os == "mac") { ldflags = exec_script("//build/macosx_sdk_libs.py", [], "list lines") ldflags += [ @@ -90,16 +82,17 @@ shared_library("c++abi") { "exported/src/cxa_exception_storage.cpp", "exported/src/cxa_guard.cpp", "exported/src/cxa_handlers.cpp", - "exported/src/cxa_new_delete.cpp", "exported/src/cxa_personality.cpp", "exported/src/cxa_thread_atexit.cpp", "exported/src/cxa_unexpected.cpp", "exported/src/cxa_vector.cpp", "exported/src/cxa_virtual.cpp", - "exported/src/exception.cpp", + "exported/src/fallback_malloc.cpp", "exported/src/private_typeinfo.cpp", - "exported/src/stdexcept.cpp", - "exported/src/typeinfo.cpp", + "exported/src/stdlib_exception.cpp", + "exported/src/stdlib_new_delete.cpp", + "exported/src/stdlib_stdexcept.cpp", + "exported/src/stdlib_typeinfo.cpp", ] public = [ diff --git a/src/third_party/libcxxabi/exported b/src/third_party/libcxxabi/exported index 219475c3..a5b1f6f7 160000 --- a/src/third_party/libcxxabi/exported +++ b/src/third_party/libcxxabi/exported @@ -1 +1 @@ -Subproject commit 219475c3ccfb2bc8bcaae610b9a89f65c537b363 +Subproject commit a5b1f6f7644b30c97a59d512d4dbe6825db424d9