xref: /llvm-project/llvm/test/tools/llvm-objcopy/ELF/group-unchanged.test (revision aa3df8ddcd52ec5e40e73cf8d25471145e3913cb)
1# RUN: yaml2obj %s -o %t
2# RUN: llvm-objcopy --remove-section=.text.bar %t %t2
3# RUN: llvm-readobj --section-groups %t2 | FileCheck %s
4
5# In this test the section .text.bar is getting removed, since this section
6# goes after all the sections comprising a group, the content of the
7# section .group doesn't change.
8
9# CHECK:           Name: .group
10# CHECK-NEXT:      Index: 1
11# CHECK-NEXT:      Link: 3
12# CHECK-NEXT:      Info: 2
13# CHECK-NEXT:      Type: COMDAT (0x1)
14# CHECK-NEXT:      Signature: foo
15# CHECK:           .text.foo (2)
16
17--- !ELF
18FileHeader:
19  Class:           ELFCLASS64
20  Data:            ELFDATA2LSB
21  Type:            ET_REL
22  Machine:         EM_X86_64
23Sections:
24  - Name:            .group
25    Type:            SHT_GROUP
26    Link:            .symtab
27    AddressAlign:    0x0000000000000004
28    Info:            foo
29    Members:
30      - SectionOrType:   GRP_COMDAT
31      - SectionOrType:   .text.foo
32  - Name:            .text.foo
33    Type:            SHT_PROGBITS
34    Flags:           [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
35    AddressAlign:    0x0000000000000010
36  - Name:            .text.bar
37    Type:            SHT_PROGBITS
38    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
39    AddressAlign:    0x0000000000000010
40Symbols:
41  - Name:            .text.foo
42    Type:            STT_SECTION
43    Section:         .text.foo
44  - Name:            .text.bar
45    Type:            STT_SECTION
46    Section:         .text.bar
47  - Name:            foo
48    Type:            STT_FUNC
49    Section:         .text.foo
50    Size:            0x0000000000000000
51    Binding:         STB_WEAK
52  - Name:            bar
53    Type:            STT_FUNC
54    Section:         .text.bar
55    Size:            0x0000000000000000
56    Binding:         STB_WEAK
57