Fixing build breakage from #4676. (#4822)

diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/BUILD b/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
index 3224513..252ac5a 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
@@ -74,6 +74,7 @@
         ":LLVMTargetOptions",
         "@llvm-project//llvm:Analysis",
         "@llvm-project//llvm:Core",
+        "@llvm-project//llvm:Instrumentation",
         "@llvm-project//llvm:Passes",
         "@llvm-project//llvm:Support",
         "@llvm-project//llvm:Target",
diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
index ed3cdd8..9dd8681 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
@@ -62,6 +62,7 @@
     ::LLVMTargetOptions
     LLVMAnalysis
     LLVMCore
+    LLVMInstrumentation
     LLVMPasses
     LLVMSupport
     LLVMTarget
diff --git a/iree/hal/local/loaders/BUILD b/iree/hal/local/loaders/BUILD
index 6d95993..8c711c3 100644
--- a/iree/hal/local/loaders/BUILD
+++ b/iree/hal/local/loaders/BUILD
@@ -32,6 +32,7 @@
     ],
     deps = [
         "//iree/base:api",
+        "//iree/base:core_headers",
         "//iree/base:dynamic_library",
         "//iree/base:flatcc",
         "//iree/base:tracing",
diff --git a/iree/hal/local/loaders/CMakeLists.txt b/iree/hal/local/loaders/CMakeLists.txt
index 217e628..9c9ab43 100644
--- a/iree/hal/local/loaders/CMakeLists.txt
+++ b/iree/hal/local/loaders/CMakeLists.txt
@@ -23,6 +23,7 @@
     "legacy_library_loader.cc"
   DEPS
     iree::base::api
+    iree::base::core_headers
     iree::base::dynamic_library
     iree::base::flatcc
     iree::base::internal::file_io
diff --git a/iree/hal/local/loaders/legacy_library_loader.cc b/iree/hal/local/loaders/legacy_library_loader.cc
index 7e59cfb..c3e9cc7 100644
--- a/iree/hal/local/loaders/legacy_library_loader.cc
+++ b/iree/hal/local/loaders/legacy_library_loader.cc
@@ -85,15 +85,20 @@
   switch (iree_DyLibExecutableDef_sanitized_kind_get(executable_def)) {
     case iree_SanitizerKind_None:
       break;
-    case iree_SanitizerKind_Address: {
-      if (!IREE_SANITIZER_ADDRESS) {
-        return iree_make_status(
-            IREE_STATUS_UNAVAILABLE,
-            "Dynamic library executable is compiled with ASAN support, but "
-            "this host application failed to enable ASAN to load this "
-            "executable");
-      }
-    } break;
+#if !defined(IREE_SANITIZER_ADDRESS)
+    case iree_SanitizerKind_Address:
+      return iree_make_status(
+          IREE_STATUS_UNAVAILABLE,
+          "Executable library is compiled with ASAN support but the host "
+          "runtime is not compiled with it enabled; add -fsanitize=address to "
+          "the runtime compilation options");
+#endif  // !IREE_SANITIZER_ADDRESS
+    default:
+      return iree_make_status(
+          IREE_STATUS_UNAVAILABLE,
+          "Executable library requires a sanitizer the host runtime is not "
+          "compiled to enable/understand: %u",
+          (uint32_t)iree_DyLibExecutableDef_sanitized_kind_get(executable_def));
   }
 
   return iree_ok_status();