Fixing ROCM bitcode deps when the compiler is built static. (#17163)

diff --git a/compiler/CMakeLists.txt b/compiler/CMakeLists.txt
index 51bcb89..79dae71 100644
--- a/compiler/CMakeLists.txt
+++ b/compiler/CMakeLists.txt
@@ -57,8 +57,9 @@
   endif()
 
   # Post processing.
-  get_property(_iree_compiler_dylib_depends GLOBAL PROPERTY IREE_COMPILER_DYLIB_DEPENDS)
-  if(_iree_compiler_dylib_depends)
-    add_dependencies(iree_compiler_API_SharedImpl ${_iree_compiler_dylib_depends})
+  get_property(_iree_compiler_depends GLOBAL PROPERTY IREE_COMPILER_DEPENDS)
+  if(_iree_compiler_depends)
+    add_dependencies(iree_compiler_API_SharedImpl ${_iree_compiler_depends})
+    add_dependencies(iree_compiler_API_StaticImpl ${_iree_compiler_depends})
   endif()
 endif()
diff --git a/compiler/plugins/target/LLVMCPU/internal/WindowsLinkerTool.cpp b/compiler/plugins/target/LLVMCPU/internal/WindowsLinkerTool.cpp
index 9267462..e8b9a38 100644
--- a/compiler/plugins/target/LLVMCPU/internal/WindowsLinkerTool.cpp
+++ b/compiler/plugins/target/LLVMCPU/internal/WindowsLinkerTool.cpp
@@ -202,7 +202,7 @@
     if (!getenv("VCToolsInstallDir") || !getenv("UniversalCRTSdkDir")) {
       llvm::errs() << "required environment for lld-link/link not specified; "
                       "ensure you are building from a shell where "
-                      "vcvarsall/VsDevCmd.bat/etc has been used";
+                      "vcvarsall/VsDevCmd.bat/etc has been used\n";
       return std::nullopt;
     }
     const char *arch;
diff --git a/compiler/plugins/target/ROCM/CMakeLists.txt b/compiler/plugins/target/ROCM/CMakeLists.txt
index 2cae4e4..e827e16 100644
--- a/compiler/plugins/target/ROCM/CMakeLists.txt
+++ b/compiler/plugins/target/ROCM/CMakeLists.txt
@@ -155,7 +155,7 @@
 )
 
 # Ensure that the device libs are built when the compiler dylib is built.
-set_property(GLOBAL APPEND PROPERTY IREE_COMPILER_DYLIB_DEPENDS
+set_property(GLOBAL APPEND PROPERTY IREE_COMPILER_DEPENDS
   iree_compiler_plugins_target_ROCM_GenDeviceLibs)
 
 # Install.
diff --git a/compiler/plugins/target/ROCM/builtins/ukernel/CMakeLists.txt b/compiler/plugins/target/ROCM/builtins/ukernel/CMakeLists.txt
index 7550141..693fe38 100644
--- a/compiler/plugins/target/ROCM/builtins/ukernel/CMakeLists.txt
+++ b/compiler/plugins/target/ROCM/builtins/ukernel/CMakeLists.txt
@@ -51,15 +51,21 @@
   endif()
   set(_COPTS
     "-x" "hip"
-    # Target architecture.
+
+    # Compile only the device code for the target architecture.
+    "--offload-device-only"
     "--offload-arch=${_ROCM_ARCH}"
 
-    # Suppress warnings about missing path to rocm lib,
-    # and benign warning about ROCM version.
-    "-nogpulib"
+    # Suppress warnings about about ROCM version (we mostly don't care).
     "-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH"
-    # Avoid error caused by clang bundling.
-    "--offload-device-only"
+
+    # Use the ROCM specified by the IREE cmake variable (instead of guessing
+    # or failing if ROCM is not on the user's path).
+    "--rocm-path=${IREE_ROCM_PATH}"
+
+    # Avoid linking in default libraries as we will link them at a later phase.
+    "-nogpulib"
+
     # Only enable necessary optimizations S.T we can use -O3.
     "-Xclang" "-disable-llvm-optzns"
     "${OPT_FLAG}"
@@ -167,7 +173,7 @@
 )
 
 # Ensure that the device libs are built when the compiler dylib is built.
-set_property(GLOBAL APPEND PROPERTY IREE_COMPILER_DYLIB_DEPENDS
+set_property(GLOBAL APPEND PROPERTY IREE_COMPILER_DEPENDS
   iree_builtin_ROCM_UkernelDeviceLibs)
 
 # Install.