--- a/cmake/onnxruntime_unittests.cmake
+++ b/cmake/onnxruntime_unittests.cmake
@@ -1352,6 +1352,14 @@ AddTest(
 )
 target_include_directories(onnxruntime_test_all PRIVATE ${ONNXRUNTIME_ROOT}/core/flatbuffers/schema) # ort.fbs.h
 
+# allocation_planner_test.cc calls the inline CUDAExecutionProvider::GetProviderOptions(),
+# but the provider module hides the implementation from this statically-linked test.
+if (onnxruntime_USE_CUDA)
+  target_sources(onnxruntime_test_all PRIVATE
+    ${ONNXRUNTIME_ROOT}/core/providers/cuda/cuda_execution_provider_info.cc)
+  target_link_options(onnxruntime_test_all PRIVATE -Wl,--gc-sections)
+endif()
+
 onnxruntime_apply_test_target_workarounds(onnxruntime_test_all)
 
 if(NOT onnxruntime_MINIMAL_BUILD AND NOT CMAKE_CROSSCOMPILING
@@ -2378,7 +2386,7 @@ endif()
       list(APPEND onnxruntime_shared_lib_test_LIBS cpuinfo)
     endif()
     if (onnxruntime_USE_CUDA)
-      list(APPEND onnxruntime_shared_lib_test_LIBS CUDA::cudart)
+      list(APPEND onnxruntime_shared_lib_test_LIBS CUDA::cudart onnxruntime_framework)
     endif()
 
     if (onnxruntime_USE_TENSORRT)
