From 10ea7316995dca0c9e31da5f838053885680f5f3 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 19 Jan 2022 21:50:51 -0800 Subject: [PATCH] [dsymutil] Don't print timestamp warning if we have no timestamp If we have no timestamp (0), don't print the corresponding warning. The binary holder already successfully ignores these cases, but the warning for swift interface files was lacking it. rdar://86036385 Differential revision: https://reviews.llvm.org/D117333 --- llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test | 5 ++--- llvm/tools/dsymutil/DwarfLinkerForBinary.cpp | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test b/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test index 43d930af7128..a16330d8c1b0 100644 --- a/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test +++ b/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test @@ -1,4 +1,5 @@ RUN: dsymutil -oso-prepend-path %p/.. %p/../Inputs/swift-ast.macho.x86_64 -o %T/swift-ast.dSYM -verbose -no-swiftmodule-timestamp | FileCheck %s --check-prefix=DSYMUTIL +RUN: dsymutil -oso-prepend-path %p/.. %p/../Inputs/swift-ast.macho.x86_64 -o %T/swift-ast.dSYM -verbose | FileCheck %s --check-prefix=DSYMUTIL RUN: llvm-readobj --sections --section-data %T/swift-ast.dSYM/Contents/Resources/DWARF/swift-ast.macho.x86_64 | FileCheck %s --check-prefix=READOBJ RUN: llvm-dwarfdump --show-section-sizes %T/swift-ast.dSYM/Contents/Resources/DWARF/swift-ast.macho.x86_64 | FileCheck %s --check-prefix=DWARFDUMP @@ -11,6 +12,7 @@ Compiled with: DSYMUTIL: filename:{{.*}}swift-ast.swiftmodule DSYMUTIL-NOT: The file was not recognized as a valid object file +DSYMUTIL-NOT: timestamp mismatch DSYMUTIL: DEBUG MAP OBJECT:{{.*}}swift-ast.swiftmodule READOBJ: Name:{{.*}}__swift_ast @@ -19,8 +21,5 @@ READOBJ-NEXT: |.| DWARFDUMP: __swift_ast -RUN: dsymutil -oso-prepend-path %p/.. %p/../Inputs/swift-ast.macho.x86_64 -no-output -verbose 2>&1 | FileCheck %s --check-prefix=TIMESTAMP -TIMESTAMP: warning: {{.*}}/swift-ast.swiftmodule: timestamp mismatch between swift interface file ({{.*}}) and debug map ({{.*}}) - RUN: dsymutil -s %T/swift-ast.dSYM/Contents/Resources/DWARF/swift-ast.macho.x86_64 | FileCheck %s --check-prefix=NAST NAST-NOT: N_AST diff --git a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp index 809b5f799b06..a8dfde086537 100644 --- a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp +++ b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp @@ -414,7 +414,8 @@ bool DwarfLinkerForBinary::link(const DebugMap &Map) { auto ModificationTime = std::chrono::time_point_cast( Stat.getLastModificationTime()); - if (ModificationTime != Obj->getTimestamp()) { + if (Obj->getTimestamp() != sys::TimePoint<>() && + ModificationTime != Obj->getTimestamp()) { // Not using the helper here as we can easily stream TimePoint<>. WithColor::warning() << File << ": timestamp mismatch between swift interface file ("