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

GitOrigin-RevId: 8140f6bcde4256b06ce8bfc85d99db6e13f435e3
diff --git a/combined.h b/combined.h
index 1aa9351..1fffea4 100644
--- a/combined.h
+++ b/combined.h
@@ -13,7 +13,6 @@
 #include "common.h"
 #include "flags.h"
 #include "flags_parser.h"
-#include "interface.h"
 #include "local_cache.h"
 #include "memtag.h"
 #include "quarantine.h"
@@ -22,6 +21,8 @@
 #include "string_utils.h"
 #include "tsd.h"
 
+#include "scudo/interface.h"
+
 #ifdef GWP_ASAN_HOOKS
 #include "gwp_asan/guarded_pool_allocator.h"
 #include "gwp_asan/optional/backtrace.h"
diff --git a/flags.cpp b/flags.cpp
index dd9f050..de5153b 100644
--- a/flags.cpp
+++ b/flags.cpp
@@ -9,7 +9,8 @@
 #include "flags.h"
 #include "common.h"
 #include "flags_parser.h"
-#include "interface.h"
+
+#include "scudo/interface.h"
 
 namespace scudo {
 
diff --git a/interface.h b/include/scudo/interface.h
similarity index 65%
rename from interface.h
rename to include/scudo/interface.h
index e263982..e527d0a 100644
--- a/interface.h
+++ b/include/scudo/interface.h
@@ -1,4 +1,4 @@
-//===-- interface.h ---------------------------------------------*- C++ -*-===//
+//===-- scudo/interface.h ---------------------------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -9,18 +9,16 @@
 #ifndef SCUDO_INTERFACE_H_
 #define SCUDO_INTERFACE_H_
 
-#include "internal_defs.h"
-
 extern "C" {
 
-WEAK INTERFACE const char *__scudo_default_options();
+__attribute__((weak)) const char *__scudo_default_options();
 
 // Post-allocation & pre-deallocation hooks.
 // They must be thread-safe and not use heap related functions.
-WEAK INTERFACE void __scudo_allocate_hook(void *ptr, size_t size);
-WEAK INTERFACE void __scudo_deallocate_hook(void *ptr);
+__attribute__((weak)) void __scudo_allocate_hook(void *ptr, size_t size);
+__attribute__((weak)) void __scudo_deallocate_hook(void *ptr);
 
-WEAK INTERFACE void __scudo_print_stats(void);
+void __scudo_print_stats(void);
 
 typedef void (*iterate_callback)(uintptr_t base, size_t size, void *arg);