summaryrefslogtreecommitdiff
path: root/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-atime.test
blob: aad537cf48eb464ce8e1893b94e42f0f4f5eb535 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Note: ls -lu prints the accessed timestamp
# NetBSD: noatime mounts currently inhibit 'touch -a' updates
# UNSUPPORTED: system-netbsd

# Preserve dates when stripping to an output file.
# RUN: yaml2obj %s > %t.1.o
# RUN: touch -a -t 199505050555.55 %t.1.o
# RUN: llvm-strip -p %t.1.o -o %t-preserved.1.o
# RUN: ls -lu %t-preserved.1.o | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME
# Check that the stripped output is in fact a valid object file.
# RUN: llvm-readobj %t-preserved.1.o

# Preserve dates available via objcopy interface as well.
# RUN: yaml2obj %s > %t.2.o
# RUN: touch -a -t 199505050555.55 %t.2.o
# RUN: llvm-objcopy -p %t.2.o %t-preserved.2.o
# RUN: ls -lu %t-preserved.2.o | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME
# RUN: llvm-readobj %t-preserved.2.o

# Preserve dates when stripping in place.
# RUN: yaml2obj %s > %t.3.o
# RUN: touch -a -t 199505050555.55 %t.3.o
# RUN: llvm-strip -p %t.3.o
# RUN: ls -lu %t.3.o | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME
# RUN: llvm-readobj %t.3.o

# Without -p set, don't preserve dates.
# RUN: yaml2obj %s > %t.4.o
# RUN: touch -a -t 199505050555.55 %t.4.o
# RUN: llvm-strip %t.4.o
# RUN: ls -lu %t.4.o | FileCheck %s --check-prefix=CHECK-NO-PRESERVE-ATIME
# RUN: llvm-readobj %t.4.o

# Preserve dates in archives.
# RUN: yaml2obj %s > %t.5.o
# RUN: rm -f %t.a
# RUN: llvm-ar cr %t.a %t.5.o
# RUN: touch -a -t 199505050555.55 %t.a
# RUN: llvm-strip -p %t.a
# RUN: ls -lu %t.a | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME
# RUN: llvm-readobj %t.a

# Preserve dates in split DWO files.
# RUN: cp %p/Inputs/dwarf.dwo %t-input.dwo
# RUN: touch -a -t 199505050555.55 %t-input.dwo
# RUN: llvm-objcopy -p --split-dwo=%t-dwo %t-input.dwo %t-nondwo
# RUN: ls -lu %t-dwo | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME
# RUN: llvm-readobj %t-dwo
# RUN: ls -lu %t-nondwo | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME
# RUN: llvm-readobj %t-nondwo

# CHECK-PRESERVE-ATIME:        {{[[:space:]]1995}}
# CHECK-NO-PRESERVE-ATIME-NOT: {{[[:space:]]1995}}

!ELF
FileHeader:
  Class:           ELFCLASS64
  Data:            ELFDATA2LSB
  Type:            ET_REL
  Machine:         EM_X86_64
Sections:
  - Name:            .text
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]