[compiler-rt] 6ba8c8a - [scudo] Provide allocator declaration
Dominic Chen via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 29 17:39:58 PDT 2022
Author: Dominic Chen
Date: 2022-03-29T17:39:45-07:00
New Revision: 6ba8c8abe982722f5e4383553d03c1c77f9dfbb0
URL: https://github.com/llvm/llvm-project/commit/6ba8c8abe982722f5e4383553d03c1c77f9dfbb0
DIFF: https://github.com/llvm/llvm-project/commit/6ba8c8abe982722f5e4383553d03c1c77f9dfbb0.diff
LOG: [scudo] Provide allocator declaration
Ensure that extern allocator declaration is visible before definition
Differential Revision: https://reviews.llvm.org/D121848
Added:
Modified:
compiler-rt/lib/scudo/standalone/wrappers_c.cpp
compiler-rt/lib/scudo/standalone/wrappers_c.h
compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/wrappers_c.cpp b/compiler-rt/lib/scudo/standalone/wrappers_c.cpp
index 81c7dd60ee334..b4d51be716cce 100644
--- a/compiler-rt/lib/scudo/standalone/wrappers_c.cpp
+++ b/compiler-rt/lib/scudo/standalone/wrappers_c.cpp
@@ -21,8 +21,6 @@
#define SCUDO_PREFIX(name) name
#define SCUDO_ALLOCATOR Allocator
-extern "C" void SCUDO_PREFIX(malloc_postinit)();
-
// Export the static allocator so that the C++ wrappers can access it.
// Technically we could have a completely separated heap for C & C++ but in
// reality the amount of cross pollination between the two is staggering.
diff --git a/compiler-rt/lib/scudo/standalone/wrappers_c.h b/compiler-rt/lib/scudo/standalone/wrappers_c.h
index 5f7f51f3cedf6..08dc679b34ca8 100644
--- a/compiler-rt/lib/scudo/standalone/wrappers_c.h
+++ b/compiler-rt/lib/scudo/standalone/wrappers_c.h
@@ -54,4 +54,9 @@ struct __scudo_mallinfo2 {
#define SCUDO_MALLINFO __scudo_mallinfo
#endif
+#if !SCUDO_ANDROID || !_BIONIC
+extern "C" void malloc_postinit();
+extern HIDDEN scudo::Allocator<scudo::Config, malloc_postinit> Allocator;
+#endif
+
#endif // SCUDO_WRAPPERS_C_H_
diff --git a/compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp b/compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp
index adb1041181232..16f495b6a353f 100644
--- a/compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp
+++ b/compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp
@@ -12,12 +12,10 @@
#if !SCUDO_ANDROID || !_BIONIC
#include "allocator_config.h"
+#include "wrappers_c.h"
#include <stdint.h>
-extern "C" void malloc_postinit();
-extern HIDDEN scudo::Allocator<scudo::Config, malloc_postinit> Allocator;
-
namespace std {
struct nothrow_t {};
enum class align_val_t : size_t {};
More information about the llvm-commits
mailing list