Index: cmake/config-ix.cmake =================================================================== --- cmake/config-ix.cmake +++ cmake/config-ix.cmake @@ -541,7 +541,7 @@ endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND SAFESTACK_SUPPORTED_ARCH AND - OS_NAME MATCHES "Darwin|Linux|FreeBSD") + OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD") set(COMPILER_RT_HAS_SAFESTACK TRUE) else() set(COMPILER_RT_HAS_SAFESTACK FALSE) Index: lib/safestack/safestack.cc =================================================================== --- lib/safestack/safestack.cc +++ lib/safestack/safestack.cc @@ -21,7 +21,9 @@ #include #include #include +#if !defined(__NetBSD__) #include +#endif #include "interception/interception.h" #include "sanitizer_common/sanitizer_common.h" Index: test/safestack/lit.cfg =================================================================== --- test/safestack/lit.cfg +++ test/safestack/lit.cfg @@ -18,8 +18,7 @@ if config.lto_supported: config.substitutions.append((r"%clang_lto_safestack ", ' '.join(config.lto_launch + [config.clang] + config.lto_flags + ['-fsanitize=safe-stack ']))) -# SafeStack tests are currently supported on Linux, FreeBSD and Darwin only. -if config.host_os not in ['Linux', 'FreeBSD', 'Darwin']: +if config.host_os not in ['Linux', 'FreeBSD', 'Darwin', 'NetBSD']: config.unsupported = True # Allow tests to use REQUIRES=stable-runtime. For use when you cannot use XFAIL