13cab2bb3Spatrick //===-- wrappers_c.cpp ------------------------------------------*- C++ -*-===// 23cab2bb3Spatrick // 33cab2bb3Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 43cab2bb3Spatrick // See https://llvm.org/LICENSE.txt for license information. 53cab2bb3Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 63cab2bb3Spatrick // 73cab2bb3Spatrick //===----------------------------------------------------------------------===// 83cab2bb3Spatrick 93cab2bb3Spatrick #include "platform.h" 103cab2bb3Spatrick 113cab2bb3Spatrick // Skip this compilation unit if compiled as part of Bionic. 123cab2bb3Spatrick #if !SCUDO_ANDROID || !_BIONIC 133cab2bb3Spatrick 143cab2bb3Spatrick #include "allocator_config.h" 153cab2bb3Spatrick #include "wrappers_c.h" 163cab2bb3Spatrick #include "wrappers_c_checks.h" 173cab2bb3Spatrick 183cab2bb3Spatrick #include <stdint.h> 193cab2bb3Spatrick #include <stdio.h> 203cab2bb3Spatrick 213cab2bb3Spatrick #define SCUDO_PREFIX(name) name 223cab2bb3Spatrick #define SCUDO_ALLOCATOR Allocator 233cab2bb3Spatrick 241f9cb04fSpatrick // Export the static allocator so that the C++ wrappers can access it. 253cab2bb3Spatrick // Technically we could have a completely separated heap for C & C++ but in 263cab2bb3Spatrick // reality the amount of cross pollination between the two is staggering. 27*d89ec533Spatrick SCUDO_REQUIRE_CONSTANT_INITIALIZATION 281f9cb04fSpatrick scudo::Allocator<scudo::Config, SCUDO_PREFIX(malloc_postinit)> SCUDO_ALLOCATOR; 293cab2bb3Spatrick 303cab2bb3Spatrick #include "wrappers_c.inc" 313cab2bb3Spatrick 323cab2bb3Spatrick #undef SCUDO_ALLOCATOR 333cab2bb3Spatrick #undef SCUDO_PREFIX 343cab2bb3Spatrick __scudo_print_stats(void)353cab2bb3Spatrickextern "C" INTERFACE void __scudo_print_stats(void) { Allocator.printStats(); } 363cab2bb3Spatrick 373cab2bb3Spatrick #endif // !SCUDO_ANDROID || !_BIONIC 38