[llvm-branch-commits] [compiler-rt] 404746b - [nsan] Remove mallopt from nsan_interceptors (#101055)

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jul 29 23:37:31 PDT 2024


Author: Daniel Martinez
Date: 2024-07-30T08:37:17+02:00
New Revision: 404746b9f21bef631eac09469bfcc35e8cfe0e63

URL: https://github.com/llvm/llvm-project/commit/404746b9f21bef631eac09469bfcc35e8cfe0e63
DIFF: https://github.com/llvm/llvm-project/commit/404746b9f21bef631eac09469bfcc35e8cfe0e63.diff

LOG: [nsan] Remove mallopt from nsan_interceptors (#101055)

Fixes a build failure on 19.1.0-rc1 when building on linux with musl as
the libc

musl does not provide mallopt, whereas glibc does. mallopt has
portability issues with other libc implementations. Just remove the use.

Co-authored-by: Daniel Martinez <danielmartinez at cock.li>
(cherry picked from commit 2c3eb8db057b9d58acd4735999f0f5d5d8d55b0d)

Added: 
    

Modified: 
    compiler-rt/lib/nsan/nsan_interceptors.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/nsan/nsan_interceptors.cpp b/compiler-rt/lib/nsan/nsan_interceptors.cpp
index 544b44f53cc42..852524bd37332 100644
--- a/compiler-rt/lib/nsan/nsan_interceptors.cpp
+++ b/compiler-rt/lib/nsan/nsan_interceptors.cpp
@@ -21,10 +21,6 @@
 
 #include <wchar.h>
 
-#if SANITIZER_LINUX
-extern "C" int mallopt(int param, int value);
-#endif
-
 using namespace __sanitizer;
 using __nsan::nsan_init_is_running;
 using __nsan::nsan_initialized;
@@ -209,12 +205,6 @@ void __nsan::InitializeInterceptors() {
   static bool initialized = false;
   CHECK(!initialized);
 
-  // Instruct libc malloc to consume less memory.
-#if SANITIZER_LINUX
-  mallopt(1, 0);          // M_MXFAST
-  mallopt(-3, 32 * 1024); // M_MMAP_THRESHOLD
-#endif
-
   InitializeMallocInterceptors();
 
   INTERCEPT_FUNCTION(memset);


        


More information about the llvm-branch-commits mailing list