summaryrefslogtreecommitdiff
path: root/src/libc_override_gcc_and_weak.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix incompatible aliasing warningsAliaksey Kandratsenka2018-08-051-4/+4
| | | | | | | We aliased functions with different signatures and gcc now correctly gives warning for that. Originally gcc 5 same code merging feature caused us to alias more than necessary, but I am not able to reproduce this problem anymore. So we're now aliasing only compatible functions.
* unbreak throw declarations on operators new/deleteAliaksey Kandratsenka2017-11-291-40/+36
| | | | | | | | | | | | | | | | | | | | | We now clearly separate PERFTOOLS_NOTHROW (used for tc_XXX functions) and throw()/noexcept (used for operators we define). The former is basically "nothrow() for our callers, nothing for us". It is roughly equivalent of what glibc declares for malloc and friends. If some exception-full C++ code calls such function it doesn't have to bother setting up exception handling around such call. Notably, it is still important for those functions to _not have throw() declarations when we're building tcmalloc. Because C++ throw() requires setting up handling of unexpected exceptions thrown from under such functions which we don't want. The later is necessary to have operators new/delete definitions have "correct" exception specifications to calm down compiler warnings. Particularly older clang versions warn if new/delete aren't defined with correct exception specifications. Also this commit fixes annoying gcc 7+ warning (and gnu++14 mode) that complains about throw() being deprecated.
* Add support for C++17 operator new/delete for overaligned types.Andrey Semashev2017-11-291-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add auto-detection of std::align_val_t presence to configure scripts. This indicates that the compiler supports C++17 operator new/delete overloads for overaligned types. - Add auto-detection of -faligned-new compiler option that appeared in gcc 7. The option allows the compiler to generate calls to the new operators. It is needed for tests. - Added overrides for the new operators. The overrides are enabled if the support for std::align_val_t has been detected. The implementation is mostly based on the infrastructure used by memalign, which had to be extended to support being used by C++ operators in addition to C functions. In particular, the debug version of the library has to distinguish memory allocated by memalign from that by operator new. The current implementation of sized overaligned delete operators do not make use of the supplied size argument except for the debug allocator because it is difficult to calculate the exact allocation size that was used to allocate memory with alignment. This can be done in the future. - Removed forward declaration of std::nothrow_t. This was not portable as the standard library is not required to provide nothrow_t directly in namespace std (it could use e.g. an inline namespace within std). The <new> header needs to be included for std::align_val_t anyway. - Fixed operator delete[] implementation in libc_override_redefine.h. - Moved TC_ALIAS definition to the beginning of the file in tcmalloc.cc so that the macro is defined before its first use in nallocx. - Added tests to verify the added operators. [alkondratenko@gmail.com: fixed couple minor warnings, and some whitespace change] [alkondratenko@gmail.com: removed addition of TC_ALIAS in debug allocator] Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
* implement support for C11 aligned_allocAliaksey Kandratsenka2017-09-161-0/+1
| | | | Just like glibc does, we simply alias it to memalign.
* Replace "throw()" by "PERFTOOLS_NOTHROW"Romain Geissler2017-07-091-14/+14
| | | | | | | | | Automatically done with: sed -e 's/\<throw[[:space:]]*([[:space:]]*)/PERFTOOLS_NOTHROW/g' -i $(git grep -l 'throw[[:space:]]*([[:space:]]*)') [alkondratenko@gmail.com: updated to define empty PERFTOOLS_NOTHROW only on pre-c++11 standards]
* Add PERFTOOLS_THROW where necessary (as detected by GCC).Romain Geissler2017-07-081-2/+2
|
* build sized delete aliases even when sized-delete is disabledAliaksey Kandratsenka2016-03-051-0/+7
| | | | | | | In this case we alias to regular delete. This is helpful because if we don't override sized delete, then apps will call version in libstdc++ which delegates calls to regular delete, which is slower than calling regular delete directly.
* always use real throw() on operators new/deleteAliaksey Kandratsenka2016-02-061-6/+6
| | | | | Since non-glibc-s have no __THROW and lack of throw() on operators gives us warning.
* Make sure the alias is not removed by link-time optimization when it can proveDuncan Sands2016-01-241-1/+1
| | | | | | | | | | | | | that it isn't used by the program, as it might still be needed to override the corresponding symbol in shared libraries (or inline assembler for that matter). For example, suppose the program uses malloc and free but not calloc and is statically linked against tcmalloc (built with -flto) and LTO is done. Then before this patch the calloc alias would be deleted by LTO due to not being used, but the malloc/free aliases would be kept because they are used by the program. Suppose the program is dynamically linked with a shared library that allocates memory using calloc and later frees it by calling free. Then calloc will use the libc memory allocator, because the calloc alias was deleted, but free will call into tcmalloc, resulting in a crash.
* implemented enabling sized-delete support at runtimeAliaksey Kandratsenka2015-11-211-2/+53
| | | | | | | Under gcc 4.5 or greater we're using ifunc function attribute to resolve sized delete operator to either plain delete implementation (default) or to sized delete (if enabled via environment variable TCMALLOC_ENABLE_SIZED_DELETE).
* implemented (disabled by default) sized delete supportAliaksey Kandratsenka2015-11-211-0/+7
| | | | | | | | | | | | gcc 5 and clang++-3.7 support sized deallocation from C++14. We are taking advantage of that by defining sized versions of operator delete. This is off by default so that if some existing programs that define own global operator delete without sized variant are not broken by tcmalloc's sized delete operator. There is also risk of breaking exiting code that deletes objects using wrong class (i.e. base class) without having virtual destructors.
* applied chromium patch fixing some build issue on androidAliaksey Kandratsenka2014-06-211-0/+5
| | | | | This applies patch from: https://codereview.chromium.org/284843002/ by jungjik.lee@samsung.com
* add uclibc supportxiaoyur3472013-12-201-0/+2
| | | | | | * some variables defined with "char *" should be modified to "const char*" * For uclibc, glibc's "void malloc_stats(void)" should be "void malloc_stats(FILE *)", is commented now. * For uclibc, __sbrk is with attribute "hidden", so we use mmap allocator for uclibc.
* added emacs -*- mode lines for google coding styleAliaksey Kandratsenka2013-10-121-0/+1
|
* Fri Feb 03 15:40:45 2012 Google Inc. <google-perftools@googlegroups.com>csilvers2012-02-041-1/+1
| | | | | | | | | | | | | | * gperftools: version 2.0 * Renamed the project from google-perftools to gperftools (csilvers) * Renamed the .deb/.rpm packagse from google-perftools to gperftools too * Renamed include directory from google/ to gperftools/ (csilvers) * Changed the 'official' perftools email in setup.py/etc * Renamed google-perftools.sln to gperftools.sln * PORTING: Removed bash-isms & grep -q in heap-checker-death_unittest.sh * Changed copyright text to reflect Google's relinquished ownership git-svn-id: http://gperftools.googlecode.com/svn/trunk@142 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
* Fri Jul 15 16:10:51 2011 Google Inc. <opensource@google.com>csilvers2011-07-161-0/+99
* google-perftools: version 1.8 release * PORTING: (Disabled) support for patching mmap on freebsd (chapp...) * PORTING: Support volatile __malloc_hook for glibc 2.14 (csilvers) * PORTING: Use _asm rdtsc and __rdtsc to get cycleclock in windows (koda) * PORTING: Fix fd vs. HANDLE compiler error on cygwin (csilvers) * PORTING: Do not test memalign or double-linking on OS X (csilvers) * PORTING: Actually enable TLS on windows (jontra) * PORTING: Some work to compile under Native Client (krasin) * PORTING: deal with pthread_once w/o -pthread on freebsd (csilvers) * Rearrange libc-overriding to make it easier to port (csilvers) * Display source locations in pprof disassembly (sanjay) * BUGFIX: Actually initialize allocator name (mec) * BUGFIX: Keep track of 'overhead' bytes in malloc reporting (csilvers) * Allow ignoring one object twice in the leak checker (glider) * BUGFIX: top10 in pprof should print 10 lines, not 11 (rsc) * Refactor vdso source files (tipp) * Some documentation cleanups * Document MAX_TOTAL_THREAD_CACHE_SIZE <= 1Gb (nsethi) * Add MallocExtension::GetOwnership(ptr) (csilvers) * BUGFIX: We were leaving out a needed $(top_srcdir) in the Makefile * PORTING: Support getting argv0 on OS X * Add 'weblist' command to pprof: like 'list' but html (sanjay) * Improve source listing in pprof (sanjay) * Cap cache sizes to reduce fragmentation (ruemmler) * Improve performance by capping or increasing sizes (ruemmler) * Add M{,un}mapReplacmenet hooks into MallocHook (ribrdb) * Refactored system allocator logic (gangren) * Include cleanups (csilvers) * Add TCMALLOC_SMALL_BUT_SLOW support (ruemmler) * Clarify that tcmalloc stats are MiB (robinson) * Remove support for non-tcmalloc debugallocation (blount) * Add a new test: malloc_hook_test (csilvers) * Change the configure script to be more crosstool-friendly (mcgrathr) * PORTING: leading-underscore changes to support win64 (csilvers) * Improve debugallocation tc_malloc_size (csilvers) * Extend atomicops.h and cyceclock to use ARM V6+ optimized code (sanek) * Change malloc-hook to use a list-like structure (llib) * Add flag to use MAP_PRIVATE in memfs_malloc (gangren) * Windows support for pprof: nul and /usr/bin/file (csilvers) * TESTING: add test on strdup to tcmalloc_test (csilvers) * Augment heap-checker to deal with no-inode maps (csilvers) * Count .dll/.dylib as shared libs in heap-checker (csilvers) * Disable sys_futex for arm; it's not always reliable (sanek) * PORTING: change lots of windows/port.h macros to functions * BUGFIX: Generate correct version# in tcmalloc.h on windows (csilvers) * PORTING: Some casting to make solaris happier about types (csilvers) * TESTING: Disable debugallocation_test in 'minimal' mode (csilvers) * Rewrite debugallocation to be more modular (csilvers) * Don't try to run the heap-checker under valgrind (ppluzhnikov) * BUGFIX: Make focused stat %'s relative, not absolute (sanjay) * BUGFIX: Don't use '//' comments in a C file (csilvers) * Quiet new-gcc compiler warnings via -Wno-unused-result, etc (csilvers) git-svn-id: http://gperftools.googlecode.com/svn/trunk@110 6b5cf1ce-ec42-a296-1ba9-69fdba395a50