diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h index bf299bc1d0d7f..cf330662cf4b4 100644 --- a/llvm/include/llvm/Support/Compiler.h +++ b/llvm/include/llvm/Support/Compiler.h @@ -423,6 +423,14 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); # define __asan_unpoison_memory_region(p, size) #endif +/// \macro LLVM_HWADDRESS_SANITIZER_BUILD +/// Whether LLVM itself is built with HWAddressSanitizer instrumentation. +#if __has_feature(hwaddress_sanitizer) +#define LLVM_HWADDRESS_SANITIZER_BUILD 1 +#else +#define LLVM_HWADDRESS_SANITIZER_BUILD 0 +#endif + /// \macro LLVM_THREAD_SANITIZER_BUILD /// Whether LLVM itself is built with ThreadSanitizer instrumentation. #if __has_feature(thread_sanitizer) || defined(__SANITIZE_THREAD__) diff --git a/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp b/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp index 784b9c1bb2d27..ef17a084b41f9 100644 --- a/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp +++ b/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp @@ -8,6 +8,7 @@ #include "llvm/Support/DynamicLibrary.h" #include "llvm/Config/config.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Path.h" @@ -15,6 +16,9 @@ #include "PipSqueak.h" +// FIXME: Missing globals/DSO https://github.com/llvm/llvm-project/issues/57206. +#if !LLVM_HWADDRESS_SANITIZER_BUILD + using namespace llvm; using namespace llvm::sys; @@ -182,3 +186,5 @@ TEST(DynamicLibrary, Unsupported) { } #endif + +#endif