1*55c81d42SFangrui Song# RUN: yaml2obj %s -o %t.o 26e4dc6f2SAlexander Shaposhnikov 36e4dc6f2SAlexander Shaposhnikov# Create an archive, specifying U so that timestamps/etc. are preserved. 46e4dc6f2SAlexander Shaposhnikov# We only test timestamps as a proxy for full deterministic writing; i.e. we 56e4dc6f2SAlexander Shaposhnikov# assume UID/GIDs are preserved if timestamps are preserved. 66e4dc6f2SAlexander Shaposhnikov# RUN: touch -t 199505050555.55 %t.o 76e4dc6f2SAlexander Shaposhnikov# RUN: rm -f %t.a 86e4dc6f2SAlexander Shaposhnikov# RUN: llvm-ar crsU %t.a %t.o 96e4dc6f2SAlexander Shaposhnikov 106e4dc6f2SAlexander Shaposhnikov# Test short flags. 116e4dc6f2SAlexander Shaposhnikov# RUN: llvm-objcopy -D %t.a %t.2D.a 126e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.2D.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 136e4dc6f2SAlexander Shaposhnikov# RUN: llvm-objcopy -U %t.a %t.2U.a 146e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.2U.a | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC 156e4dc6f2SAlexander Shaposhnikov 166e4dc6f2SAlexander Shaposhnikov# RUN: llvm-strip -D %t.a -o %t.3D.a 176e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.3D.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 186e4dc6f2SAlexander Shaposhnikov# RUN: llvm-strip -U %t.a -o %t.3U.a 196e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.3U.a | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC 206e4dc6f2SAlexander Shaposhnikov 216e4dc6f2SAlexander Shaposhnikov# Test long flags. 226e4dc6f2SAlexander Shaposhnikov# RUN: llvm-objcopy --enable-deterministic-archives %t.a %t.4D.a 236e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.4D.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 246e4dc6f2SAlexander Shaposhnikov# RUN: llvm-objcopy --disable-deterministic-archives %t.a %t.4U.a 256e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.4U.a | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC 266e4dc6f2SAlexander Shaposhnikov 276e4dc6f2SAlexander Shaposhnikov# RUN: llvm-strip --enable-deterministic-archives %t.a -o %t.5D.a 286e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.5D.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 296e4dc6f2SAlexander Shaposhnikov# RUN: llvm-strip --disable-deterministic-archives %t.a -o %t.5U.a 306e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.5U.a | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC 316e4dc6f2SAlexander Shaposhnikov 326e4dc6f2SAlexander Shaposhnikov# If unspecified, verify that deterministic is the default. 336e4dc6f2SAlexander Shaposhnikov# RUN: llvm-objcopy %t.a %t.6.a 346e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.6.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 356e4dc6f2SAlexander Shaposhnikov# RUN: llvm-strip %t.a -o %t.7.a 366e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.7.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 376e4dc6f2SAlexander Shaposhnikov 386e4dc6f2SAlexander Shaposhnikov# If both are specified, last one wins. 396e4dc6f2SAlexander Shaposhnikov# RUN: llvm-objcopy -U -D %t.a %t.8.a 406e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.8.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 416e4dc6f2SAlexander Shaposhnikov# RUN: llvm-objcopy -D -U %t.a %t.9.a 426e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.9.a | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC 436e4dc6f2SAlexander Shaposhnikov# RUN: llvm-objcopy -D -U -D -U --enable-deterministic-archives %t.a %t.10.a 446e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.10.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 456e4dc6f2SAlexander Shaposhnikov 466e4dc6f2SAlexander Shaposhnikov# RUN: llvm-strip -U -D %t.a -o %t.11.a 476e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.11.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 486e4dc6f2SAlexander Shaposhnikov# RUN: llvm-strip -D -U %t.a -o %t.12.a 496e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.12.a | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC 506e4dc6f2SAlexander Shaposhnikov# RUN: llvm-strip -D -U -D -U --enable-deterministic-archives %t.a -o %t.13.a 516e4dc6f2SAlexander Shaposhnikov# RUN: env TZ=GMT llvm-ar tv %t.13.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 526e4dc6f2SAlexander Shaposhnikov 536e4dc6f2SAlexander Shaposhnikov# CHECK-DETERMINISTIC: {{[[:space:]]1970[[:space:]]}} 546e4dc6f2SAlexander Shaposhnikov# CHECK-NONDETERMINISTIC: {{[[:space:]]1995[[:space:]]}} 556e4dc6f2SAlexander Shaposhnikov 566e4dc6f2SAlexander Shaposhnikov!ELF 576e4dc6f2SAlexander ShaposhnikovFileHeader: 586e4dc6f2SAlexander Shaposhnikov Class: ELFCLASS64 596e4dc6f2SAlexander Shaposhnikov Data: ELFDATA2LSB 606e4dc6f2SAlexander Shaposhnikov Type: ET_REL 616e4dc6f2SAlexander Shaposhnikov Machine: EM_X86_64 626e4dc6f2SAlexander ShaposhnikovSections: 636e4dc6f2SAlexander Shaposhnikov - Name: .text 646e4dc6f2SAlexander Shaposhnikov Type: SHT_PROGBITS 656e4dc6f2SAlexander Shaposhnikov Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 66