llvm.org GIT mirror llvm / 6a6b44f
Remove LLVM_ENABLE_TIMESTAMPS Summary: As per the discussion on LLVM-dev this patch proposes removing LLVM_ENABLE_TIMESTAMPS. The only complicated bit of this patch is the Windows support. On windows we used to log an error if /INCREMENTAL was passed to the linker when timestamps were disabled. With this change since timestamps in code are always disabled we will always compile on windows with /Brepro unless /INCREMENTAL is specified, and we will log a warning when /INCREMENTAL is specified to notify the user that the build will be non-deterministic. See: http://lists.llvm.org/pipermail/llvm-dev/2016-May/098990.html Reviewers: bogner, silvas, rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19892 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268670 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Bieneman 4 years ago
5 changed file(s) with 12 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
248248 option(BUILD_SHARED_LIBS
249249 "Build all libraries as shared libraries instead of static" OFF)
250250
251 option(LLVM_ENABLE_TIMESTAMPS "Enable embedding timestamp information in build" OFF)
252 if(LLVM_ENABLE_TIMESTAMPS)
253 set(ENABLE_TIMESTAMPS 1)
254 endif()
255
256251 option(LLVM_ENABLE_BACKTRACES "Enable embedding backtraces on crash." ON)
257252 if(LLVM_ENABLE_BACKTRACES)
258253 set(ENABLE_BACKTRACES 1)
364364 CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
365365 endif()
366366
367 if (NOT LLVM_ENABLE_TIMESTAMPS AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
367 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
368368 # clang-cl and cl by default produce non-deterministic binaries because
369369 # link.exe /incremental requires a timestamp in the .obj file. clang-cl
370 # has the flag /Brepro to force deterministic binaries, so pass that when
371 # LLVM_ENABLE_TIMESTAMPS is turned off.
370 # has the flag /Brepro to force deterministic binaries. We want to pass that
371 # whenever you're building with clang unless you're passing /incremental.
372372 # This checks CMAKE_CXX_COMPILER_ID in addition to check_cxx_compiler_flag()
373373 # because cl.exe does not emit an error on flags it doesn't understand,
374374 # letting check_cxx_compiler_flag() claim it understands all flags.
375375 check_cxx_compiler_flag("/Brepro" SUPPORTS_BREPRO)
376 append_if(SUPPORTS_BREPRO "/Brepro" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
377
378376 if (SUPPORTS_BREPRO)
379377 # Check if /INCREMENTAL is passed to the linker and complain that it
380378 # won't work with /Brepro.
382380 string(TOUPPER "${CMAKE_MODULE_LINKER_FLAGS}" upper_module_flags)
383381 string(TOUPPER "${CMAKE_SHARED_LINKER_FLAGS}" upper_shared_flags)
384382
385 string(FIND "${upper_exe_flags}" "/INCREMENTAL" exe_index)
386 string(FIND "${upper_module_flags}" "/INCREMENTAL" module_index)
387 string(FIND "${upper_shared_flags}" "/INCREMENTAL" shared_index)
383 string(FIND "${upper_exe_flags} ${upper_module_flags} ${upper_shared_flags}"
384 "/INCREMENTAL" linker_flag_idx)
388385
389 if (${exe_index} GREATER -1 OR
390 ${module_index} GREATER -1 OR
391 ${shared_index} GREATER -1)
392 message(FATAL_ERROR "LLVM_ENABLE_TIMESTAMPS not compatible with /INCREMENTAL linking")
386 if (${linker_flag_idx} GREATER -1)
387 message(WARNING "/Brepro not compatible with /INCREMENTAL linking - builds will be non-deterministic")
388 else()
389 append("/Brepro" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
393390 endif()
394391 endif()
395392 endif()
455452 endif()
456453 endif (LLVM_ENABLE_WARNINGS)
457454 append_if(LLVM_ENABLE_WERROR "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
458 if (NOT LLVM_ENABLE_TIMESTAMPS)
459 add_flag_if_supported("-Werror=date-time" WERROR_DATE_TIME)
460 endif ()
455 add_flag_if_supported("-Werror=date-time" WERROR_DATE_TIME)
461456 if (LLVM_ENABLE_CXX1Y)
462457 check_cxx_compiler_flag("-std=c++1y" CXX_SUPPORTS_CXX1Y)
463458 append_if(CXX_SUPPORTS_CXX1Y "-std=c++1y" CMAKE_CXX_FLAGS)
1414
1515 /* Define if position independent code is enabled */
1616 #cmakedefine ENABLE_PIC
17
18 /* Define if timestamp information (e.g., __DATE__) is allowed */
19 #cmakedefine ENABLE_TIMESTAMPS ${ENABLE_TIMESTAMPS}
2017
2118 /* Define to 1 if you have the `arc4random' function. */
2219 #cmakedefine HAVE_DECL_ARC4RANDOM ${HAVE_DECL_ARC4RANDOM}
17741774 if (CPU == "generic")
17751775 CPU = "(unknown)";
17761776 OS << ".\n"
1777 #if (ENABLE_TIMESTAMPS == 1)
1778 << " Built " << __DATE__ << " (" << __TIME__ << ").\n"
1779 #endif
17801777 << " Default target: " << sys::getDefaultTargetTriple() << '\n'
17811778 << " Host CPU: " << CPU << '\n';
17821779 }
374374 echo "#" env CC="$c_compiler" CXX="$cxx_compiler" \
375375 cmake -G "Unix Makefiles" \
376376 -DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
377 -DLLVM_ENABLE_TIMESTAMPS=OFF -DLLVM_CONFIGTIME="(timestamp not enabled)" \
377 -DLLVM_CONFIGTIME="(timestamp not enabled)" \
378378 $ExtraConfigureFlags $BuildDir/llvm.src \
379379 2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log
380380 env CC="$c_compiler" CXX="$cxx_compiler" \
381381 cmake -G "Unix Makefiles" \
382382 -DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
383 -DLLVM_ENABLE_TIMESTAMPS=OFF -DLLVM_CONFIGTIME="(timestamp not enabled)" \
383 -DLLVM_CONFIGTIME="(timestamp not enabled)" \
384384 $ExtraConfigureFlags $BuildDir/llvm.src \
385385 2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log
386386 fi