[llvm] [llvm][cmake] Pass /Brepro to linker (PR #201708)

Miguel A. Arroyo via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 15:51:35 PDT 2026


https://github.com/mayanez created https://github.com/llvm/llvm-project/pull/201708

* The /Brepro flag should also be passed to the linker. The `BUILD.gn` correctly does [this](https://github.com/llvm/llvm-project/blob/70f7167ce2622a610a6d6dca4d5934ea8a07a056/llvm/utils/gn/build/BUILD.gn#L332).
* The /Brepro flag in `clang-cl` omits the timestamp for .obj files while the linker flag omits the timestamp for .exe and .dll files.

>From ee4592d102a960cb55cd728541d828169b93d360 Mon Sep 17 00:00:00 2001
From: Miguel Arroyo <Miguel.Arroyo at rockstargames.com>
Date: Thu, 4 Jun 2026 15:47:35 -0700
Subject: [PATCH] [llvm][cmake] Pass /Brepro to linker

---
 llvm/cmake/modules/HandleLLVMOptions.cmake | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 75bd8ed11e1ba..e14fd9e931810 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -700,7 +700,8 @@ if( MSVC )
     has_msvc_incremental_no_flag("${CMAKE_MODULE_LINKER_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${CMAKE_MODULE_LINKER_FLAGS}" NO_INCR_MODULE)
     has_msvc_incremental_no_flag("${CMAKE_SHARED_LINKER_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${CMAKE_SHARED_LINKER_FLAGS}" NO_INCR_SHARED)
     if (NO_INCR_EXE AND NO_INCR_MODULE AND NO_INCR_SHARED)
-      append("/Brepro" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+      # The /Brepro flag in `clang-cl` omits the timestamp for .obj files while the linker flag omits the timestamp for .exe and .dll files.
+      append("/Brepro" CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
     else()
       message(WARNING "/Brepro not compatible with /INCREMENTAL linking - builds will be non-deterministic")
     endif()



More information about the llvm-commits mailing list