[llvm] r246905 - WinCOFFObjectWriter.cpp: Roll back TimeDateStamp along ENABLE_TIMESTAMPS.

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 18:57:51 PDT 2015


It cannot be optional if you are using the MSVC linker with the
/incremental option.  Not setting the timestamp will cause the linker to
not consider the object file as it will be considered older than the
executable.

We can disable it for MinGW targets but I don't think we can for MSVC ones.

On Fri, Sep 4, 2015 at 6:17 PM, NAKAMURA Takumi via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: chapuni
> Date: Fri Sep  4 20:17:49 2015
> New Revision: 246905
>
> URL: http://llvm.org/viewvc/llvm-project?rev=246905&view=rev
> Log:
> WinCOFFObjectWriter.cpp: Roll back TimeDateStamp along ENABLE_TIMESTAMPS.
>
> We want a deterministic output. GNU AS leaves it zero.
>
> FIXME: It may be optional by its user, like llc and clang.
>
> Modified:
>     llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
>
> Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=246905&r1=246904&r2=246905&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)
> +++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Fri Sep  4 20:17:49 2015
> @@ -1013,12 +1013,17 @@ void WinCOFFObjectWriter::writeObject(MC
>
>    Header.PointerToSymbolTable = offset;
>
> +#if (ENABLE_TIMESTAMPS == 1)
>    // MS LINK expects to be able to use this timestamp to implement their
>    // /INCREMENTAL feature.
>    std::time_t Now = time(nullptr);
>    if (Now < 0 || !isUInt<32>(Now))
>      Now = UINT32_MAX;
>    Header.TimeDateStamp = Now;
> +#else
> +  // We want a deterministic output. It looks like GNU as also writes 0
> in here.
> +  Header.TimeDateStamp = 0;
> +#endif
>
>    // Write it all to disk...
>    WriteFileHeader(Header);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150904/16812bec/attachment.html>


More information about the llvm-commits mailing list