[llvm-elfabi] Add flag to preserve timestamp when output is the same
authorHaowei Wu <haowei@google.com>
Wed, 9 Dec 2020 01:23:53 +0000 (17:23 -0800)
committerHaowei Wu <haowei@google.com>
Tue, 29 Dec 2020 22:43:47 +0000 (14:43 -0800)
commitfddb41744958d21635a60622cfb4067122810bcc
tree47f14dc18af1be47f1d2d9654f5ae491b673092d
parent7e5a187de31358741f9868cdee7b0c63c1343d8d
[llvm-elfabi] Add flag to preserve timestamp when output is the same

This change adds '--write-if-changed' flag to llvm-elfabi tool. When
enabled, llvm-elfabi will not overwrite the existing file if the
content of the file will not be changed, which preserves the
timestamp.

Differential Revision: https://reviews.llvm.org/D92902
llvm/include/llvm/InterfaceStub/ELFObjHandler.h
llvm/lib/InterfaceStub/ELFObjHandler.cpp
llvm/test/tools/llvm-elfabi/preserve-dates-stub.test [new file with mode: 0644]
llvm/test/tools/llvm-elfabi/preserve-dates-tbe.test [new file with mode: 0644]
llvm/tools/llvm-elfabi/llvm-elfabi.cpp