Debian Codegraph @

llvm/test/tools/llvm-objcopy/ELF/binary-output-empty.test

raw
1 # RUN: yaml2obj %s -o %t.o
2
3 # Writing an empty output to a non-existent file will still create it.
4 # RUN: rm -f %t-new.txt
5 # RUN: llvm-objcopy -R .text -O binary %t.o %t-new.txt
6 # RUN: wc -c %t-new.txt | FileCheck %s
7
8 # Writing an empty output to an existing file will truncate it.
9 # RUN: echo abcd > %t-existing.txt
10 # RUN: llvm-objcopy -R .text -O binary %t.o %t-existing.txt
11 # RUN: wc -c %t-existing.txt | FileCheck %s
12
13 # In both cases, the file should be empty.
14 # CHECK: 0
15
16 !ELF
17 FileHeader:
18 Class: ELFCLASS64
19 Data: ELFDATA2LSB
20 Type: ET_EXEC
21 Machine: EM_X86_64
22 Sections:
23 - Name: .text
24 Type: SHT_PROGBITS
25 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
26 Content: "c3c3c3c3"
27 Size: 0x1000