Georgii Rymar a6436b0b3a [yaml2obj] - Make the 'Machine' key optional.
Currently we have to set 'Machine' to something in our
YAML descriptions. Usually we use 'EM_X86_64' for 64-bit targets
and 'EM_386' for 32-bit targets. At the same time, in fact, in most
cases our tests do not need a machine type and we can use
'EM_NONE'.

This is cleaner, because avoids the need of using a particular machine.

In this patch I've made the 'Machine' key optional (the default value,
when it is not specified is `EM_NONE`) and removed it (where possible)
from yaml2obj, obj2yaml and llvm-readobj tests.

There are few tests left where I decided not to remove it, because
I didn't want to touch CHECK lines or doing anything more complex
than a removing a "Machine: *" line and formatting lines around.

Differential revision: https://reviews.llvm.org/D86202
2020-08-20 11:40:51 +03:00

126 lines
3.8 KiB
Plaintext

## Check that llvm-readelf and llvm-readobj can
## dump SHT_GROUP sections properly.
# RUN: yaml2obj %s -o %t.o
# RUN: llvm-readobj -g %t.o | FileCheck %s
# RUN: llvm-readelf -g %t.o | FileCheck --check-prefix=GNU %s
# CHECK: Groups {
# CHECK-NEXT: Group {
# CHECK-NEXT: Name: .group
# CHECK-NEXT: Index: 1
# CHECK-NEXT: Link: 7
# CHECK-NEXT: Info: 1
# CHECK-NEXT: Type: COMDAT
# CHECK-NEXT: Signature: foo
# CHECK-NEXT: Section(s) in group [
# CHECK-NEXT: .text.foo
# CHECK-NEXT: .rela.text.foo
# CHECK-NEXT: ]
# CHECK-NEXT: }
# CHECK-NEXT: Group {
# CHECK-NEXT: Name: .group1
# CHECK-NEXT: Index: 2
# CHECK-NEXT: Link: 7
# CHECK-NEXT: Info: 2
# CHECK-NEXT: Type: COMDAT
# CHECK-NEXT: Signature: bar
# CHECK-NEXT: Section(s) in group [
# CHECK-NEXT: .text.bar
# CHECK-NEXT: .rela.text.bar
# CHECK-NEXT: ]
# CHECK-NEXT: }
# GNU: COMDAT group section [ 1] `.group' [foo] contains 2 sections:
# GNU-NEXT: [Index] Name
# GNU-NEXT: [ 3] .text.foo
# GNU-NEXT: [ 4] .rela.text.foo
# GNU: COMDAT group section [ 2] `.group1' [bar] contains 2 sections:
# GNU-NEXT: [Index] Name
# GNU-NEXT: [ 5] .text.bar
# GNU-NEXT: [ 6] .rela.text.bar
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Sections:
- Name: .group
Type: SHT_GROUP
Link: .symtab
Info: foo
Members:
- SectionOrType: GRP_COMDAT
- SectionOrType: .text.foo
- SectionOrType: .rela.text.foo
- Name: .group1
Type: SHT_GROUP
Link: .symtab
Info: bar
Members:
- SectionOrType: GRP_COMDAT
- SectionOrType: [[TEXTBARNAME=.text.bar]]
- SectionOrType: .rela.text.bar
- Name: .text.foo
Type: SHT_PROGBITS
- Name: .rela.text.foo
Type: SHT_RELA
Link: .symtab
Info: .text.foo
- Name: .text.bar
Type: SHT_PROGBITS
- Name: .rela.text.bar
Type: SHT_RELA
Link: .symtab
Info: .text.bar
Symbols:
- Name: foo
Section: .text.foo
- Name: bar
Section: .text.bar
## Check that we report a warning and continue dumping when a section is included
## in two group sections at the same time.
# RUN: yaml2obj %s -DTEXTBARNAME=.text.foo -o %t.dup.o
# RUN: llvm-readobj --elf-section-groups %t.dup.o 2>&1 | FileCheck %s -DFILE=%t.dup.o --check-prefix=DUP-LLVM
# RUN: llvm-readelf --elf-section-groups %t.dup.o 2>&1 | FileCheck %s -DFILE=%t.dup.o --check-prefix=DUP-GNU
# DUP-LLVM: Group {
# DUP-LLVM-NEXT: Name: .group
# DUP-LLVM-NEXT: Index: 1
# DUP-LLVM-NEXT: Link: 7
# DUP-LLVM-NEXT: Info: 1
# DUP-LLVM-NEXT: Type: COMDAT
# DUP-LLVM-NEXT: Signature: foo
# DUP-LLVM-NEXT: Section(s) in group [
# DUP-LLVM-NEXT: .text.foo (3)
# DUP-LLVM-NEXT: .rela.text.foo (4)
# DUP-LLVM-NEXT: ]
# DUP-LLVM-NEXT: }
# DUP-LLVM: Group {
# DUP-LLVM-NEXT: Name: .group1
# DUP-LLVM-NEXT: Index: 2
# DUP-LLVM-NEXT: Link: 7
# DUP-LLVM-NEXT: Info: 2
# DUP-LLVM-NEXT: Type: COMDAT
# DUP-LLVM-NEXT: Signature: bar
# DUP-LLVM-NEXT: Section(s) in group [
# DUP-LLVM-NEXT: warning: '[[FILE]]': section with index 3, included in the group section with index 1, was also found in the group section with index 2
# DUP-LLVM-NEXT: .text.foo (3)
# DUP-LLVM-NEXT: .rela.text.bar (6)
# DUP-LLVM-NEXT: ]
# DUP-LLVM-NEXT: }
# DUP-GNU: COMDAT group section [ 1] `.group' [foo] contains 2 sections:
# DUP-GNU-NEXT: [Index] Name
# DUP-GNU-NEXT: [ 3] .text.foo
# DUP-GNU-NEXT: [ 4] .rela.text.foo
# DUP-GNU: COMDAT group section [ 2] `.group1' [bar] contains 2 sections:
# DUP-GNU-NEXT: [Index] Name
# DUP-GNU-NEXT: warning: '[[FILE]]': section with index 3, included in the group section with index 1, was also found in the group section with index 2
# DUP-GNU-NEXT: [ 3] .text.foo
# DUP-GNU-NEXT: [ 6] .rela.text.bar