1# Note: ls -l prints the modified timestamp
2
3# Preserve dates when stripping to an output file.
4# RUN: yaml2obj %s -o %t.1.o
5# RUN: touch -m -t 199705050555.55 %t.1.o
6# RUN: llvm-strip -p %t.1.o -o %t-preserved.1.o
7# RUN: ls -l %t-preserved.1.o | FileCheck %s --check-prefix=CHECK-PRESERVE-MTIME
8# Check that the stripped output is in fact a valid object file.
9# RUN: llvm-readobj %t-preserved.1.o
10
11# Preserve dates available via objcopy interface as well.
12# RUN: yaml2obj %s -o %t.2.o
13# RUN: touch -m -t 199705050555.55 %t.2.o
14# RUN: llvm-objcopy -p %t.2.o %t-preserved.2.o
15# RUN: ls -l %t-preserved.2.o | FileCheck %s --check-prefix=CHECK-PRESERVE-MTIME
16# RUN: llvm-readobj %t-preserved.2.o
17
18# Preserve dates when stripping in place.
19# RUN: yaml2obj %s -o %t.3.o
20# RUN: touch -m -t 199705050555.55 %t.3.o
21# RUN: llvm-strip -p %t.3.o
22# RUN: ls -l %t.3.o | FileCheck %s --check-prefix=CHECK-PRESERVE-MTIME
23# RUN: llvm-readobj %t.3.o
24
25# Without -p set, don't preserve dates.
26# RUN: yaml2obj %s -o %t.4.o
27# RUN: touch -m -t 199705050555.55 %t.4.o
28# RUN: llvm-strip %t.4.o
29# RUN: ls -l %t.4.o | FileCheck %s --check-prefix=CHECK-NO-PRESERVE-MTIME
30# RUN: llvm-readobj %t.4.o
31
32# Preserve dates in archives.
33# RUN: yaml2obj %s -o %t.5.o
34# RUN: rm -f %t.a
35# RUN: llvm-ar cr %t.a %t.5.o
36# RUN: touch -m -t 199705050555.55 %t.a
37# RUN: llvm-strip -p %t.a
38# RUN: ls -l %t.a | FileCheck %s --check-prefix=CHECK-PRESERVE-MTIME
39# RUN: llvm-readobj %t.a
40
41# Preserve dates in split DWO files.
42# RUN: cp %p/Inputs/dwarf.dwo %t-input.dwo
43# RUN: touch -m -t 199705050555.55 %t-input.dwo
44# RUN: llvm-objcopy -p --split-dwo=%t-dwo %t-input.dwo %t-nondwo
45# RUN: ls -l %t-dwo | FileCheck %s --check-prefix=CHECK-PRESERVE-MTIME
46# RUN: llvm-readobj %t-dwo
47# RUN: ls -l %t-nondwo | FileCheck %s --check-prefix=CHECK-PRESERVE-MTIME
48# RUN: llvm-readobj %t-nondwo
49
50# CHECK-PRESERVE-MTIME:        {{[[:space:]]1997}}
51# CHECK-NO-PRESERVE-MTIME-NOT: {{[[:space:]]1997}}
52
53!ELF
54FileHeader:
55  Class:           ELFCLASS64
56  Data:            ELFDATA2LSB
57  Type:            ET_REL
58  Machine:         EM_X86_64
59Sections:
60  - Name:            .text
61    Type:            SHT_PROGBITS
62    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
63