From f4db9ead0635c54d9fc5c67d7f3951dd031dfa1c Mon Sep 17 00:00:00 2001 From: Alex Reinking Date: Tue, 1 Sep 2026 11:21:40 -0400 Subject: [PATCH] [python] Disable incremental linking for Windows AOT runtime test modules The runtime module test targets link a Halide-generated AOT static library into a DLL with /WHOLEARCHIVE. On the Windows CI matrix, which reconfigures and rebuilds the same tree for many Halide_TARGETs in a row, this has intermittently failed with LNK1236 ("corrupt or invalid COFF sections") when relinking against a changed archive. These modules are one-shot build artifacts, so incremental linking has nothing to offer and is a plausible source of the corruption. --- python_bindings/halide-runtime/test/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python_bindings/halide-runtime/test/CMakeLists.txt b/python_bindings/halide-runtime/test/CMakeLists.txt index 0615dfdbb2b3..5a86fb642585 100644 --- a/python_bindings/halide-runtime/test/CMakeLists.txt +++ b/python_bindings/halide-runtime/test/CMakeLists.txt @@ -29,6 +29,15 @@ function(add_runtime_test_kernel MOD) add_library(${MOD}_module MODULE aot_module_stub.c) target_link_libraries(${MOD}_module PRIVATE "$") set_target_properties(${MOD}_module PROPERTIES PREFIX "" OUTPUT_NAME ${MOD}) + + if (MSVC) + # link.exe's incremental linker can corrupt a /WHOLEARCHIVE module + # (LNK1236: corrupt or invalid COFF sections) when relinking it against + # a changed archive in an existing build tree. These modules are only + # ever built once per configuration, so incremental linking buys us + # nothing and isn't worth the risk. + target_link_options(${MOD}_module PRIVATE /INCREMENTAL:NO) + endif () endfunction() # A tiny kernel: load, call, and Buffer interop.