xref: /llvm-project/llvm/test/tools/llvm-objcopy/ELF/strip-dwo-groups.test (revision 68616584c3a5ce9352b37d24e408b171928f6840)
199f73ebeSGeorge Rimar# RUN: yaml2obj %s -o %t
2298ea3f5SJordan Rupprecht# RUN: llvm-objcopy --strip-dwo %t
3*68616584SIgor Kudrin# RUN: llvm-readobj --symbols -S --section-groups %t | \
4*68616584SIgor Kudrin# RUN:   FileCheck %s --implicit-check-not=.debug_
56e4dc6f2SAlexander Shaposhnikov
699f73ebeSGeorge Rimar## `llvm-objcopy --strip-dwo` strips out dwo sections, as a result, the index of
799f73ebeSGeorge Rimar## the symbol table, the indices of the symbols and the indices of the sections
8*68616584SIgor Kudrin## which go after the removed ones will change. Consequently, the fields Link,
9*68616584SIgor Kudrin## Info and the content of .group need to be updated.
106e4dc6f2SAlexander Shaposhnikov
11*68616584SIgor Kudrin## Note. 'Signature' is generated using 'Link' and 'Info', so checking it
12*68616584SIgor Kudrin## validates updating these fields.
1352499079SGeorge Rimar
1499f73ebeSGeorge Rimar# CHECK:      Groups {
1552499079SGeorge Rimar# CHECK-NEXT:  Group {
16*68616584SIgor Kudrin# CHECK-NEXT:   Name: .group
17*68616584SIgor Kudrin# CHECK-NEXT:   Index:
18*68616584SIgor Kudrin# CHECK-NEXT:   Link:
19*68616584SIgor Kudrin# CHECK-NEXT:   Info:
20*68616584SIgor Kudrin# CHECK-NEXT:   Type:
2199f73ebeSGeorge Rimar# CHECK-NEXT:   Signature: group1
2299f73ebeSGeorge Rimar# CHECK-NEXT:   Section(s) in group [
23*68616584SIgor Kudrin# CHECK-NEXT:     .text.group1
2499f73ebeSGeorge Rimar# CHECK-NEXT:   ]
256e4dc6f2SAlexander Shaposhnikov
26*68616584SIgor Kudrin# CHECK:        Name: .group
27*68616584SIgor Kudrin# CHECK-NEXT:   Index:
28*68616584SIgor Kudrin# CHECK-NEXT:   Link:
29*68616584SIgor Kudrin# CHECK-NEXT:   Info:
30*68616584SIgor Kudrin# CHECK-NEXT:   Type:
3199f73ebeSGeorge Rimar# CHECK-NEXT:   Signature: group2
3299f73ebeSGeorge Rimar# CHECK-NEXT:   Section(s) in group [
33*68616584SIgor Kudrin# CHECK-NEXT:     .text.group2
34*68616584SIgor Kudrin# CHECK-NEXT:     .rela.text.group2
3599f73ebeSGeorge Rimar# CHECK-NEXT:   ]
366e4dc6f2SAlexander Shaposhnikov
3799f73ebeSGeorge Rimar--- !ELF
3899f73ebeSGeorge RimarFileHeader:
3999f73ebeSGeorge Rimar  Class:   ELFCLASS64
4099f73ebeSGeorge Rimar  Data:    ELFDATA2LSB
4199f73ebeSGeorge Rimar  Type:    ET_REL
4299f73ebeSGeorge Rimar  Machine: EM_X86_64
4399f73ebeSGeorge RimarSections:
4499f73ebeSGeorge Rimar  - Name: .debug_before.dwo
4599f73ebeSGeorge Rimar    Type: SHT_PROGBITS
4699f73ebeSGeorge Rimar  - Name: .group
4799f73ebeSGeorge Rimar    Type: SHT_GROUP
4899f73ebeSGeorge Rimar    Link: .symtab
4999f73ebeSGeorge Rimar    Info: group1
5099f73ebeSGeorge Rimar    Members:
5199f73ebeSGeorge Rimar      - SectionOrType: GRP_COMDAT
5299f73ebeSGeorge Rimar      - SectionOrType: .text.group1
5399f73ebeSGeorge Rimar  - Name:  .text.group1
5499f73ebeSGeorge Rimar    Type:  SHT_PROGBITS
5599f73ebeSGeorge Rimar    Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
56e2b134b0SGeorgii Rymar  - Name: '.group (1)'
5799f73ebeSGeorge Rimar    Type: SHT_GROUP
5899f73ebeSGeorge Rimar    Link: .symtab
5999f73ebeSGeorge Rimar    Info: group2
6099f73ebeSGeorge Rimar    Members:
6199f73ebeSGeorge Rimar      - SectionOrType: GRP_COMDAT
6299f73ebeSGeorge Rimar      - SectionOrType: .text.group2
6399f73ebeSGeorge Rimar      - SectionOrType: .rela.text.group2
6499f73ebeSGeorge Rimar  - Name:  .text.group2
6599f73ebeSGeorge Rimar    Type:  SHT_PROGBITS
6699f73ebeSGeorge Rimar    Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
6799f73ebeSGeorge Rimar  - Name:  .rela.text.group2
6899f73ebeSGeorge Rimar    Type:  SHT_RELA
6999f73ebeSGeorge Rimar    Flags: [ SHF_GROUP ]
7099f73ebeSGeorge Rimar    Info:  .text.group2
7199f73ebeSGeorge Rimar  - Name: .debug_after.dwo
7299f73ebeSGeorge Rimar    Type: SHT_PROGBITS
7399f73ebeSGeorge RimarSymbols:
7499f73ebeSGeorge Rimar  - Name:    debug_before
7599f73ebeSGeorge Rimar    Section: .debug_before.dwo
7699f73ebeSGeorge Rimar  - Name:    debug_after
7799f73ebeSGeorge Rimar    Section: .debug_after.dwo
78792c206eSFangrui Song  - Name:    group2
79792c206eSFangrui Song    Section: .text.group2
80792c206eSFangrui Song    Binding: STB_WEAK
81792c206eSFangrui Song  - Name:    group1
82792c206eSFangrui Song    Section: .text.group1
83792c206eSFangrui Song    Binding: STB_WEAK
84