1# RUN: yaml2obj %s -o %t.o 2 3# Create an archive, specifying U so that timestamps/etc. are preserved. 4# We only test timestamps as a proxy for full deterministic writing; i.e. we 5# assume UID/GIDs are preserved if timestamps are preserved. 6# RUN: touch -t 199505050555.55 %t.o 7# RUN: rm -f %t.a 8# RUN: llvm-ar crsU %t.a %t.o 9 10# Test short flags. 11# RUN: llvm-objcopy -D %t.a %t.2D.a 12# RUN: env TZ=GMT llvm-ar tv %t.2D.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 13# RUN: llvm-objcopy -U %t.a %t.2U.a 14# RUN: env TZ=GMT llvm-ar tv %t.2U.a | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC 15 16# RUN: llvm-strip -D %t.a -o %t.3D.a 17# RUN: env TZ=GMT llvm-ar tv %t.3D.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 18# RUN: llvm-strip -U %t.a -o %t.3U.a 19# RUN: env TZ=GMT llvm-ar tv %t.3U.a | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC 20 21# Test long flags. 22# RUN: llvm-objcopy --enable-deterministic-archives %t.a %t.4D.a 23# RUN: env TZ=GMT llvm-ar tv %t.4D.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 24# RUN: llvm-objcopy --disable-deterministic-archives %t.a %t.4U.a 25# RUN: env TZ=GMT llvm-ar tv %t.4U.a | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC 26 27# RUN: llvm-strip --enable-deterministic-archives %t.a -o %t.5D.a 28# RUN: env TZ=GMT llvm-ar tv %t.5D.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 29# RUN: llvm-strip --disable-deterministic-archives %t.a -o %t.5U.a 30# RUN: env TZ=GMT llvm-ar tv %t.5U.a | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC 31 32# If unspecified, verify that deterministic is the default. 33# RUN: llvm-objcopy %t.a %t.6.a 34# RUN: env TZ=GMT llvm-ar tv %t.6.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 35# RUN: llvm-strip %t.a -o %t.7.a 36# RUN: env TZ=GMT llvm-ar tv %t.7.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 37 38# If both are specified, last one wins. 39# RUN: llvm-objcopy -U -D %t.a %t.8.a 40# RUN: env TZ=GMT llvm-ar tv %t.8.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 41# RUN: llvm-objcopy -D -U %t.a %t.9.a 42# RUN: env TZ=GMT llvm-ar tv %t.9.a | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC 43# RUN: llvm-objcopy -D -U -D -U --enable-deterministic-archives %t.a %t.10.a 44# RUN: env TZ=GMT llvm-ar tv %t.10.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 45 46# RUN: llvm-strip -U -D %t.a -o %t.11.a 47# RUN: env TZ=GMT llvm-ar tv %t.11.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 48# RUN: llvm-strip -D -U %t.a -o %t.12.a 49# RUN: env TZ=GMT llvm-ar tv %t.12.a | FileCheck %s --check-prefix=CHECK-NONDETERMINISTIC 50# RUN: llvm-strip -D -U -D -U --enable-deterministic-archives %t.a -o %t.13.a 51# RUN: env TZ=GMT llvm-ar tv %t.13.a | FileCheck %s --check-prefix=CHECK-DETERMINISTIC 52 53# CHECK-DETERMINISTIC: {{[[:space:]]1970[[:space:]]}} 54# CHECK-NONDETERMINISTIC: {{[[:space:]]1995[[:space:]]}} 55 56!ELF 57FileHeader: 58 Class: ELFCLASS64 59 Data: ELFDATA2LSB 60 Type: ET_REL 61 Machine: EM_X86_64 62Sections: 63 - Name: .text 64 Type: SHT_PROGBITS 65 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 66