Files
clang-p2996/llvm/test/tools/llvm-readobj/ELF/sections.test
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

105 lines
3.1 KiB
Plaintext

## Check how llvm-readobj prints sections with --sections.
## We test the --sections flag for llvm-readelf in the gnu-sections.test.
# RUN: yaml2obj %s -o %t64
# RUN: llvm-readobj --sections %t64 | FileCheck %s --check-prefixes=ELF,ELF64
# RUN: yaml2obj -DBITS=32 %s -o %t32
# RUN: llvm-readobj --sections %t32 | FileCheck %s --check-prefixes=ELF,ELF32
## Check flag aliases produce identical output.
# RUN: llvm-readobj --sections %t64 > %t64.llvm.sections
# RUN: llvm-readobj -S %t64 > %t64.llvm.upper.s
# RUN: cmp %t64.llvm.sections %t64.llvm.upper.s
# RUN: llvm-readobj -s %t64 > %t64.llvm.lower.s
# RUN: cmp %t64.llvm.sections %t64.llvm.lower.s
# RUN: llvm-readobj --section-headers %t64 > %t64.llvm.section-headers
# RUN: cmp %t64.llvm.sections %t64.llvm.section-headers
# RUN: llvm-readobj --sections %t32 > %t32.llvm.sections
# RUN: llvm-readobj -S %t32 > %t32.llvm.upper.s
# RUN: cmp %t32.llvm.sections %t32.llvm.upper.s
# RUN: llvm-readobj -s %t32 > %t32.llvm.lower.s
# RUN: cmp %t32.llvm.sections %t32.llvm.lower.s
# RUN: llvm-readobj --section-headers %t32 > %t32.llvm.section-headers
# RUN: cmp %t32.llvm.sections %t32.llvm.section-headers
# ELF: Sections [
# ELF-NEXT: Section {
# ELF-NEXT: Index: 0
# ELF-NEXT: Name: (0)
# ELF-NEXT: Type: SHT_NULL (0x0)
# ELF-NEXT: Flags [ (0x0)
# ELF-NEXT: ]
# ELF-NEXT: Address: 0x0
# ELF-NEXT: Offset: 0x0
# ELF-NEXT: Size: 0
# ELF-NEXT: Link: 0
# ELF-NEXT: Info: 0
# ELF-NEXT: AddressAlignment: 0
# ELF-NEXT: EntrySize: 0
# ELF-NEXT: }
# ELF-NEXT: Section {
# ELF-NEXT: Index: 1
# ELF-NEXT: Name: .foo (1)
# ELF-NEXT: Type: SHT_PROGBITS (0x1)
# ELF-NEXT: Flags [ (0x3)
# ELF-NEXT: SHF_ALLOC (0x2)
# ELF-NEXT: SHF_WRITE (0x1)
# ELF-NEXT: ]
# ELF-NEXT: Address: 0x2
# ELF64-NEXT: Offset: 0x41
# ELF32-NEXT: Offset: 0x37
# ELF-NEXT: Size: 3
# ELF-NEXT: Link: 4
# ELF-NEXT: Info: 1
# ELF-NEXT: AddressAlignment: 5
# ELF-NEXT: EntrySize: 6
# ELF-NEXT: }
# ELF-NEXT: Section {
# ELF-NEXT: Index: 2
# ELF-NEXT: Name: .strtab (16)
# ELF-NEXT: Type: SHT_STRTAB (0x3)
# ELF-NEXT: Flags [ (0x0)
# ELF-NEXT: ]
# ELF-NEXT: Address: 0x0
# ELF64-NEXT: Offset: 0x44
# ELF32-NEXT: Offset: 0x3A
# ELF-NEXT: Size: 1
# ELF-NEXT: Link: 0
# ELF-NEXT: Info: 0
# ELF-NEXT: AddressAlignment: 1
# ELF-NEXT: EntrySize: 0
# ELF-NEXT: }
# ELF-NEXT: Section {
# ELF-NEXT: Index: 3
# ELF-NEXT: Name: .shstrtab (6)
# ELF-NEXT: Type: SHT_STRTAB (0x3)
# ELF-NEXT: Flags [ (0x0)
# ELF-NEXT: ]
# ELF-NEXT: Address: 0x0
# ELF64-NEXT: Offset: 0x45
# ELF32-NEXT: Offset: 0x3B
# ELF-NEXT: Size: 24
# ELF-NEXT: Link: 0
# ELF-NEXT: Info: 0
# ELF-NEXT: AddressAlignment: 1
# ELF-NEXT: EntrySize: 0
# ELF-NEXT: }
# ELF-NEXT: ]
--- !ELF
FileHeader:
Class: ELFCLASS[[BITS=64]]
Data: ELFDATA2LSB
Type: ET_REL
Sections:
- Name: .foo
Type: SHT_PROGBITS
Info: 1
Address: 0x2
Size: 0x3
Flags: [ SHF_WRITE, SHF_ALLOC ]
Link: 4
AddressAlign: 5
EntSize: 6