|
| 1 | +## Note: ls -l prints the modified timestamp. |
| 2 | + |
| 3 | +# RUN: yaml2obj %s -o %t.exe |
| 4 | + |
| 5 | +## Preserve dates when stripping to an output file. |
| 6 | +# RUN: cp %t.exe %t.1.exe |
| 7 | +# RUN: touch -m -t 199705050555.55 %t.1.exe |
| 8 | +# RUN: llvm-strip -p %t.1.exe -o %t-preserved.1.exe |
| 9 | +# RUN: ls -l %t-preserved.1.exe | FileCheck %s --check-prefix=CHECK-PRESERVE-MTIME |
| 10 | +## Check that the stripped output is in fact a valid object file and the timestamp in the PE header is preserved. |
| 11 | +# RUN: llvm-readobj --headers %t-preserved.1.exe | FileCheck %s |
| 12 | + |
| 13 | +## Preserve dates available via objcopy interface as well. |
| 14 | +# RUN: cp %t.exe %t.2.exe |
| 15 | +# RUN: touch -m -t 199705050555.55 %t.2.exe |
| 16 | +# RUN: llvm-objcopy -p %t.2.exe %t-preserved.2.exe |
| 17 | +# RUN: ls -l %t-preserved.2.exe | FileCheck %s --check-prefix=CHECK-PRESERVE-MTIME |
| 18 | +# RUN: llvm-readobj --headers %t-preserved.2.exe | FileCheck %s |
| 19 | + |
| 20 | +## Preserve dates when stripping in place. |
| 21 | +# RUN: cp %t.exe %t.3.exe |
| 22 | +# RUN: touch -m -t 199705050555.55 %t.3.exe |
| 23 | +# RUN: llvm-strip -p %t.3.exe |
| 24 | +# RUN: ls -l %t.3.exe | FileCheck %s --check-prefix=CHECK-PRESERVE-MTIME |
| 25 | +# RUN: llvm-readobj --headers %t.3.exe | FileCheck %s |
| 26 | + |
| 27 | +## Without -p set, don't preserve dates. |
| 28 | +# RUN: cp %t.exe %t.4.exe |
| 29 | +# RUN: touch -m -t 199705050555.55 %t.4.exe |
| 30 | +# RUN: llvm-strip %t.4.exe |
| 31 | +# RUN: ls -l %t.4.exe | FileCheck %s --check-prefix=CHECK-NO-PRESERVE-MTIME |
| 32 | +# RUN: llvm-readobj --headers %t.4.exe | FileCheck %s |
| 33 | + |
| 34 | +## Always preserve the timestamp in the PE header. |
| 35 | +# CHECK: TimeDateStamp: 1970-01-01 00:00:00 (0x0) |
| 36 | + |
| 37 | +# CHECK-PRESERVE-MTIME: {{[[:space:]]1997}} |
| 38 | +# CHECK-NO-PRESERVE-MTIME-NOT: {{[[:space:]]1997}} |
| 39 | + |
| 40 | +!COFF |
| 41 | +OptionalHeader: |
| 42 | + Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI |
| 43 | +header: |
| 44 | + Machine: IMAGE_FILE_MACHINE_AMD64 |
| 45 | +sections: |
| 46 | + - Name: .text |
| 47 | + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] |
| 48 | + VirtualSize: 20 |
| 49 | +symbols: [] |
| 50 | +... |
0 commit comments