1# RUN: yaml2obj %s -o %t
2# RUN: llvm-objcopy --strip-all-gnu %t %t2
3# RUN: llvm-strip --strip-all-gnu %t -o %t3
4# RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s
5# RUN: cmp %t2 %t3
6
7# Show that the debug section in a segment was removed, to match GNU.
8# First validate that the offset in use is correct.
9# RUN: llvm-objcopy %t %t4
10# RUN: od -t x1 -N 4 -j 120 %t4 | FileCheck %s --ignore-case --check-prefix=COPY-BYTES
11# RUN: od -t x1 -N 4 -j 120 %t2 | FileCheck %s --ignore-case --check-prefix=STRIP-BYTES
12
13!ELF
14FileHeader:
15  Class:           ELFCLASS64
16  Data:            ELFDATA2LSB
17  Type:            ET_REL
18  Machine:         EM_X86_64
19Sections:
20  - Name:            .debug_in_segment
21    Type:            SHT_PROGBITS
22    Flags:           [ ]
23    Content:         "deadbeef"
24  - Name:            .dynstr
25    Type:            SHT_STRTAB
26    Flags:           [ SHF_ALLOC ]
27  - Name:            .symtab.dyn
28    Type:            SHT_SYMTAB
29    Flags:           [ SHF_ALLOC ]
30    Type:            SHT_NOBITS
31  - Name:            .text
32    Type:            SHT_PROGBITS
33    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
34    Size:            4
35  - Name:            .debug_info
36    Type:            SHT_PROGBITS
37    Flags:           [ ]
38    AddressAlign:    0x1
39    Size:            4
40  - Name:            .debug_loc
41    Type:            SHT_PROGBITS
42    Flags:           [ SHF_ALLOC ]
43    AddressAlign:    0x1
44    Size:            4
45  - Name:            .comment
46    Type:            SHT_PROGBITS
47  - Name:            .random_section_name
48    Type:            SHT_PROGBITS
49  - Name:            .debug_not_a_real_debug_section
50    Type:            SHT_PROGBITS
51  - Name:            .rel.text
52    Type:            SHT_REL
53    Info:            .text
54  - Name:            .rela.text
55    Type:            SHT_RELA
56    Info:            .text
57ProgramHeaders:
58  # Use an arbitrary segment type to show that the segment type is unimportant.
59  - Type:     0x61234567
60    FirstSec: .debug_in_segment
61    LastSec:  .debug_in_segment
62
63# CHECK: SectionHeaderCount: 8
64
65# CHECK:      Name: .dynstr
66# CHECK:      Name: .symtab.dyn
67# CHECK:      Name: .text
68# CHECK:      Name: .debug_loc
69# CHECK:      Name: .comment
70# CHECK:      Name: .random_section_name
71# CHECK:      Name: .shstrtab
72
73# COPY-BYTES:  de ad be ef
74# STRIP-BYTES: 00 00 00 00
75