[llvm] r256137 - [MC, COFF] Unbreak support for COFF timestamps

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 00:03:08 PST 2015


Author: majnemer
Date: Mon Dec 21 02:03:07 2015
New Revision: 256137

URL: http://llvm.org/viewvc/llvm-project?rev=256137&view=rev
Log:
[MC, COFF] Unbreak support for COFF timestamps

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.

Modified:
    llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
    llvm/trunk/test/MC/COFF/timestamp.s
    llvm/trunk/test/lit.cfg
    llvm/trunk/test/lit.site.cfg.in

Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=256137&r1=256136&r2=256137&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Mon Dec 21 02:03:07 2015
@@ -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"

Modified: llvm/trunk/test/MC/COFF/timestamp.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/timestamp.s?rev=256137&r1=256136&r2=256137&view=diff
==============================================================================
--- llvm/trunk/test/MC/COFF/timestamp.s (original)
+++ llvm/trunk/test/MC/COFF/timestamp.s Mon Dec 21 02:03:07 2015
@@ -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)

Modified: llvm/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.cfg?rev=256137&r1=256136&r2=256137&view=diff
==============================================================================
--- llvm/trunk/test/lit.cfg (original)
+++ llvm/trunk/test/lit.cfg Mon Dec 21 02:03:07 2015
@@ -463,6 +463,10 @@ if platform.system() in ['Windows'] and
 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:

Modified: llvm/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.site.cfg.in?rev=256137&r1=256136&r2=256137&view=diff
==============================================================================
--- llvm/trunk/test/lit.site.cfg.in (original)
+++ llvm/trunk/test/lit.site.cfg.in Mon Dec 21 02:03:07 2015
@@ -36,6 +36,7 @@ config.llvm_use_sanitizer = "@LLVM_USE_S
 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




More information about the llvm-commits mailing list