summaryrefslogtreecommitdiffstats
path: root/llvm/cmake/modules/HandleLLVMOptions.cmake
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2016-01-06 19:05:19 +0000
committerNico Weber <nicolasweber@gmx.de>2016-01-06 19:05:19 +0000
commit891419adc276e70861a59c0f13084b743dd90e76 (patch)
tree27dd6f399f10512098b55625f2108306f40718d7 /llvm/cmake/modules/HandleLLVMOptions.cmake
parentab69e9f497404abc21f8a7d47918002a8b777531 (diff)
downloadbcm5719-llvm-891419adc276e70861a59c0f13084b743dd90e76.tar.gz
bcm5719-llvm-891419adc276e70861a59c0f13084b743dd90e76.zip
Make WinCOFFObjectWriter.cpp's timestamp writing not use ENABLE_TIMESTAMPS
LLVM_ENABLE_TIMESTAMPS controls if timestamps are embedded into llvm's binaries. Turning it off is useful for deterministic builds. r246905 made it so that the define suddenly also controls if the binaries that the llvm binaries _create_ embed timestamps or not – but this shouldn't be a configure-time option. r256203/r256204 added a driver option to toggle this on and off, so this patch now passes this driver option in LLVM_ENABLE_TIMESTAMPS builds so that if LLVM_ENABLE_TIMESTAMPS is set, the build of LLVM is deterministic – but the built clang can still write timestamps into other executables when requested. This also allows removing some of the test machinery added in r292012 to work around this problem. See PR24740 for background. http://reviews.llvm.org/D15783 llvm-svn: 256958
Diffstat (limited to 'llvm/cmake/modules/HandleLLVMOptions.cmake')
-rw-r--r--llvm/cmake/modules/HandleLLVMOptions.cmake30
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 4c5ffe2f7b2..6db258ff66a 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -363,6 +363,36 @@ if( MSVC )
append("/Zc:inline" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ if (NOT LLVM_ENABLE_TIMESTAMPS AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ # clang-cl and cl by default produce non-deterministic binaries because
+ # link.exe /incremental requires a timestamp in the .obj file. clang-cl
+ # has the flag /Brepro to force deterministic binaries, so pass that when
+ # LLVM_ENABLE_TIMESTAMPS is turned off.
+ # This checks CMAKE_CXX_COMPILER_ID in addition to check_cxx_compiler_flag()
+ # because cl.exe does not emit an error on flags it doesn't understand,
+ # letting check_cxx_compiler_flag() claim it understands all flags.
+ check_cxx_compiler_flag("/Brepro" SUPPORTS_BREPRO)
+ append_if(SUPPORTS_BREPRO "/Brepro" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+
+ if (SUPPORTS_BREPRO)
+ # Check if /INCREMENTAL is passed to the linker and complain that it
+ # won't work with /Brepro.
+ string(TOUPPER "${CMAKE_EXE_LINKER_FLAGS}" upper_exe_flags)
+ string(TOUPPER "${CMAKE_MODULE_LINKER_FLAGS}" upper_module_flags)
+ string(TOUPPER "${CMAKE_SHARED_LINKER_FLAGS}" upper_shared_flags)
+
+ string(FIND "${upper_exe_flags}" "/INCREMENTAL" exe_index)
+ string(FIND "${upper_module_flags}" "/INCREMENTAL" module_index)
+ string(FIND "${upper_shared_flags}" "/INCREMENTAL" shared_index)
+
+ if (${exe_index} GREATER -1 OR
+ ${module_index} GREATER -1 OR
+ ${shared_index} GREATER -1)
+ message(FATAL_ERROR "LLVM_ENABLE_TIMESTAMPS not compatible with /INCREMENTAL linking")
+ endif()
+ endif()
+ endif()
+
# Disable sized deallocation if the flag is supported. MSVC fails to compile
# the operator new overload in User otherwise.
check_c_compiler_flag("/WX /Zc:sizedDealloc-" SUPPORTS_SIZED_DEALLOC)
OpenPOWER on IntegriCloud