[MC, COFF] Unbreak support for COFF timestamps
authorDavid Majnemer <david.majnemer@gmail.com>
Mon, 21 Dec 2015 08:03:07 +0000 (08:03 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Mon, 21 Dec 2015 08:03:07 +0000 (08:03 +0000)
Support for COFF timestamps was unintentionally broken in r246905 when
it was conditionally available depending on whether or not LLVM was
configured with LLVM_ENABLE_TIMESTAMPS.  However, Config/config.h was
never included which essentially broke the feature.  Due to lax testing,
the breakage was never identified until we observed strange failures
during incremental links of Chromium.

This issue is resolved by simply including Config/config.h in
WinCOFFObjectWriter and teaching lit that the MC/COFF/timestamp.s test
is conditionally supported depending on LLVM_ENABLE_TIMESTAMPS.  With
this in place, we can strengthen the test to ensure that it will not
accidentally get broken in the future.

This fixes PR25891.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256137 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/WinCOFFObjectWriter.cpp
test/MC/COFF/timestamp.s
test/lit.cfg
test/lit.site.cfg.in

index 59f06dcd113c49f9e3e2cb3f3287c414eccecf43..ffb636a593284f1403bb5f7f3299f5a7a569e4f9 100644 (file)
@@ -17,6 +17,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/Config/config.h"
 #include "llvm/MC/MCAsmLayout.h"
 #include "llvm/MC/MCAssembler.h"
 #include "llvm/MC/MCContext.h"
index 917e1e717a89c895c733a6f026998b1365d4d6af..ae982b4309e5016d8118d55751d4b0dab1c11cd4 100644 (file)
@@ -1,4 +1,6 @@
 // RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s -o - | llvm-readobj -h | FileCheck %s
+// REQUIRES: timestamps
 
 // CHECK: ImageFileHeader {
-// CHECK:   TimeDateStamp: {{.*}}
+// CHECK:   TimeDateStamp:
+// CHECK-NOT: 1970-01-01 00:00:00 (0x0)
index 9fb9fb2b4de1972b5d8f9ab7cf2a6ef938daba22..3fb94e43f72bb1e88c314abd16fe16ac304ba671 100644 (file)
@@ -463,6 +463,10 @@ if platform.system() in ['Windows'] and re.match(r'.*-win32$', config.target_tri
 if not re.match(r'^x86_64.*-(mingw32|windows-gnu|win32)', config.target_triple):
     config.available_features.add('debug_frame')
 
+# Check if we are embedding timestamps.
+if config.enable_timestamps:
+    config.available_features.add('timestamps')
+
 # Check if we should use gmalloc.
 use_gmalloc_str = lit_config.params.get('use_gmalloc', None)
 if use_gmalloc_str is not None:
index 13f5372ef7e3cee68aaf9209a69ebc6baba77dd5..ae5814f02f41b2763ab313d67a0648487f396268 100644 (file)
@@ -36,6 +36,7 @@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.have_zlib = "@HAVE_LIBZ@"
 config.have_dia_sdk = @HAVE_DIA_SDK@
 config.enable_ffi = "@LLVM_ENABLE_FFI@"
+config.enable_timestamps = "@ENABLE_TIMESTAMPS@"
 config.test_examples = "@ENABLE_EXAMPLES@"
 
 # Support substitution of the tools_dir with user parameters. This is