Index: clang/lib/Driver/SanitizerArgs.cpp =================================================================== --- clang/lib/Driver/SanitizerArgs.cpp +++ clang/lib/Driver/SanitizerArgs.cpp @@ -567,7 +567,8 @@ // Setup blacklist files. // Add default blacklist from resource directory. - addDefaultBlacklists(D, Kinds, SystemBlacklistFiles); + if (!Args.getLastArgNoClaim(options::OPT_fno_sanitize_blacklist)) + addDefaultBlacklists(D, Kinds, SystemBlacklistFiles); // Parse -f(no-)?sanitize-blacklist options. // This also validates special case lists format. Index: clang/test/Driver/fsanitize-blacklist.c =================================================================== --- clang/test/Driver/fsanitize-blacklist.c +++ clang/test/Driver/fsanitize-blacklist.c @@ -60,7 +60,11 @@ // CHECK-ONLY_FIRST-DISABLED-NOT: good // If cfi_blacklist.txt cannot be found in the resource dir, driver should fail. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-BLACKLIST +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-BLACKLIST // CHECK-MISSING-CFI-BLACKLIST: error: no such file or directory: '{{.*}}cfi_blacklist.txt' +// -fno-sanitize-blacklist disables checking for cfi_blacklist.txt in the resource dir. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -fno-sanitize-blacklist -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-NO-BLACKLIST +// CHECK-MISSING-CFI-NO-BLACKLIST-NOT: error: no such file or directory: '{{.*}}cfi_blacklist.txt' + // DELIMITERS: {{^ *"}}