Debian Codegraph @

llvm/test/tools/llvm-objcopy/ELF/remove-section-in-group.test

raw
1 ## This checks that the group section is shrunk when its member is removed.
2
3 # RUN: yaml2obj --docnum=1 %s -o - \
4 # RUN: | llvm-objcopy -R .foo - - \
5 # RUN: | obj2yaml - \
6 # RUN: | FileCheck %s
7
8 # CHECK: - Name: .group
9 # CHECK: Members:
10 # CHECK-NEXT: - SectionOrType: GRP_COMDAT
11 # CHECK-NEXT: - SectionOrType: .bar
12 # CHECK-NOT: - SectionOrType:
13
14 --- !ELF
15 FileHeader:
16 Class: ELFCLASS64
17 Data: ELFDATA2LSB
18 Type: ET_REL
19 Machine: EM_X86_64
20 Sections:
21 - Name: .group
22 Type: SHT_GROUP
23 Info: foo_bar_grp
24 Members:
25 - SectionOrType: GRP_COMDAT
26 - SectionOrType: .foo
27 - SectionOrType: .bar
28 - Name: .foo
29 Type: SHT_PROGBITS
30 Flags: [ SHF_ALLOC, SHF_GROUP ]
31 - Name: .bar
32 Type: SHT_PROGBITS
33 Flags: [ SHF_ALLOC, SHF_GROUP ]
34 Symbols:
35 - Name: foo_bar_grp
36 Section: .group
37 Binding: STB_GLOBAL
38
39 # RUN: yaml2obj --docnum=2 %s -o %t
40 # RUN: llvm-objcopy --remove-section=.debug_macro %t
41 # RUN: llvm-readelf --section-groups %t | FileCheck %s --check-prefix=GROUP-REMOVED
42
43 --- !ELF
44 FileHeader:
45 Class: ELFCLASS64
46 Data: ELFDATA2LSB
47 Type: ET_REL
48 Machine: EM_X86_64
49 Sections:
50 - Name: .group
51 Type: SHT_GROUP
52 Info: foo_grp
53 Members:
54 - SectionOrType: GRP_COMDAT
55 - SectionOrType: .debug_macro
56 - Name: .debug_macro
57 Type: SHT_PROGBITS
58 Flags: [ SHF_GROUP ]
59 Symbols:
60 - Name: foo_grp
61 Section: .group
62
63 # GROUP-REMOVED: There are no section groups in this file.
64
65 # RUN: yaml2obj --docnum=3 %s -o %t
66 # RUN: llvm-objcopy --remove-section=.group %t
67 # RUN: llvm-readelf --section-groups %t | FileCheck %s --check-prefix=EMPTY-GROUP-REMOVED
68
69 --- !ELF
70 FileHeader:
71 Class: ELFCLASS64
72 Data: ELFDATA2LSB
73 Type: ET_REL
74 Machine: EM_X86_64
75 Sections:
76 - Name: .group
77 Type: SHT_GROUP
78 Info: foo_grp
79 Members:
80 - SectionOrType: GRP_COMDAT
81 Symbols:
82 - Name: foo_grp
83 Section: .group
84
85 # EMPTY-GROUP-REMOVED: There are no section groups in this file.