[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>
Wed, 30 Dec 2020 04:27:06 +0000 (20:27 -0800)
commita1d0589266865998785c996668d828445f10fc98
tree4f5169d6fc8606694ea801df24d75c6c767d54e1
parent11f41cd4451554d6ad6065dc7cd6c9349159c567
[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