Skip to content

Commit 8140f6b

Browse files
committed
scudo: Create a public include directory. NFCI.
For MTE error reporting we will need to expose interfaces for crash handlers to use to interpret scudo headers and metadata. The intent is that these interfaces will live in scudo/interface.h. Move the existing interface.h into an include/scudo directory and make it independent of the internal headers, so that we will be able to add the interfaces there. Differential Revision: https://reviews.llvm.org/D76648
1 parent 318a0ca commit 8140f6b

File tree

6 files changed

+17
-12
lines changed

6 files changed

+17
-12
lines changed

compiler-rt/lib/scudo/standalone/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ if (COMPILER_RT_HAS_GWP_ASAN)
33
add_dependencies(scudo_standalone gwp_asan)
44
endif()
55

6-
include_directories(../..)
6+
include_directories(../.. include)
77

88
set(SCUDO_CFLAGS)
99

@@ -56,7 +56,6 @@ set(SCUDO_HEADERS
5656
flags.h
5757
flags_parser.h
5858
fuchsia.h
59-
interface.h
6059
internal_defs.h
6160
linux.h
6261
list.h
@@ -78,6 +77,8 @@ set(SCUDO_HEADERS
7877
vector.h
7978
wrappers_c_checks.h
8079
wrappers_c.h
80+
81+
include/scudo/interface.h
8182
)
8283

8384
set(SCUDO_SOURCES

compiler-rt/lib/scudo/standalone/combined.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "common.h"
1414
#include "flags.h"
1515
#include "flags_parser.h"
16-
#include "interface.h"
1716
#include "local_cache.h"
1817
#include "memtag.h"
1918
#include "quarantine.h"
@@ -22,6 +21,8 @@
2221
#include "string_utils.h"
2322
#include "tsd.h"
2423

24+
#include "scudo/interface.h"
25+
2526
#ifdef GWP_ASAN_HOOKS
2627
#include "gwp_asan/guarded_pool_allocator.h"
2728
#include "gwp_asan/optional/backtrace.h"

compiler-rt/lib/scudo/standalone/flags.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
#include "flags.h"
1010
#include "common.h"
1111
#include "flags_parser.h"
12-
#include "interface.h"
12+
13+
#include "scudo/interface.h"
1314

1415
namespace scudo {
1516

compiler-rt/lib/scudo/standalone/interface.h renamed to compiler-rt/lib/scudo/standalone/include/scudo/interface.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- interface.h ---------------------------------------------*- C++ -*-===//
1+
//===-- scudo/interface.h ---------------------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -9,18 +9,16 @@
99
#ifndef SCUDO_INTERFACE_H_
1010
#define SCUDO_INTERFACE_H_
1111

12-
#include "internal_defs.h"
13-
1412
extern "C" {
1513

16-
WEAK INTERFACE const char *__scudo_default_options();
14+
__attribute__((weak)) const char *__scudo_default_options();
1715

1816
// Post-allocation & pre-deallocation hooks.
1917
// They must be thread-safe and not use heap related functions.
20-
WEAK INTERFACE void __scudo_allocate_hook(void *ptr, size_t size);
21-
WEAK INTERFACE void __scudo_deallocate_hook(void *ptr);
18+
__attribute__((weak)) void __scudo_allocate_hook(void *ptr, size_t size);
19+
__attribute__((weak)) void __scudo_deallocate_hook(void *ptr);
2220

23-
WEAK INTERFACE void __scudo_print_stats(void);
21+
void __scudo_print_stats(void);
2422

2523
typedef void (*iterate_callback)(uintptr_t base, size_t size, void *arg);
2624

compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ set(SCUDO_UNITTEST_CFLAGS
1010
-I${COMPILER_RT_SOURCE_DIR}/include
1111
-I${COMPILER_RT_SOURCE_DIR}/lib
1212
-I${COMPILER_RT_SOURCE_DIR}/lib/scudo/standalone
13+
-I${COMPILER_RT_SOURCE_DIR}/lib/scudo/standalone/include
1314
-DGTEST_HAS_RTTI=0
1415
-DSCUDO_DEBUG=1
1516
# Extra flags for the C++ tests

llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/BUILD.gn

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ source_set("cxx_wrapper_sources") {
8888
}
8989

9090
config("scudo_config") {
91-
include_dirs = [ "//compiler-rt/lib/scudo/standalone" ]
91+
include_dirs = [
92+
"//compiler-rt/lib/scudo/standalone",
93+
"//compiler-rt/lib/scudo/standalone/include",
94+
]
9295
if (current_os == "android") {
9396
cflags = [ "-fno-emulated-tls" ]
9497
}

0 commit comments

Comments
 (0)