-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[nsan] Remove mallopt from nsan_interceptors #101055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Daniel Martinez (Calandracas606) ChangesFixes 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 Full diff: https://github.com/llvm/llvm-project/pull/101055.diff 1 Files Affected:
diff --git a/compiler-rt/lib/nsan/nsan_interceptors.cpp b/compiler-rt/lib/nsan/nsan_interceptors.cpp
index 544b44f53cc42..baa8185994113 100644
--- a/compiler-rt/lib/nsan/nsan_interceptors.cpp
+++ b/compiler-rt/lib/nsan/nsan_interceptors.cpp
@@ -21,7 +21,7 @@
#include <wchar.h>
-#if SANITIZER_LINUX
+#if SANITIZER_LINUX && defined(__GLIBC__)
extern "C" int mallopt(int param, int value);
#endif
@@ -210,7 +210,7 @@ void __nsan::InitializeInterceptors() {
CHECK(!initialized);
// Instruct libc malloc to consume less memory.
-#if SANITIZER_LINUX
+#if SANITIZER_LINUX && defined(__GLIBC__)
mallopt(1, 0); // M_MXFAST
mallopt(-3, 32 * 1024); // M_MMAP_THRESHOLD
#endif
|
Perhaps we should just remove |
I could update the PR to remove mallopt if prefered |
Yeah, i think it should be easier to remove it |
Other sanitizers don't use mallopt, musl doesn't provide mallopt, and tcmalloc ignores mallopt. Its easiest jut to remove it
ab03fed
to
c3a9242
Compare
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@cock.li> (cherry picked from commit 2c3eb8d)
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@cock.li> (cherry picked from commit 2c3eb8d)
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.