[scudo] Provide allocator declaration

Ensure that extern allocator declaration is visible before definition

Differential Revision: https://reviews.llvm.org/D121848
This commit is contained in:
Dominic Chen 2022-03-16 13:35:51 -07:00
parent 030d8262a6
commit 6ba8c8abe9
3 changed files with 6 additions and 5 deletions

View file

@ -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.

View file

@ -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_

View file

@ -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 {};