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