We have the `ELF\sections.test` to test --sections. `ELF\sections.test` uses precompiled objects, it has a bug (does not test -s alias properly). Also, we test machine specific section types in `ELF\machine-specific-section-types.test`, so we probably do not need to test `--sections` for a MIPS object in `ELF\sections.test`. I think it is enough to test ELF32 and ELF64 (we do not test ELF64 in this test). `Object/readobj-shared-object.test` also tests how llvm-readobj handles `--sections`. It is location is wrong, it is not complete, it uses precompiled binaries and it duplicates the `ELF\sections.test` partially (it tests both ELF32 and ELF64). We have `ELF\readelf-s-alias.test` that tests the `-s` alias for `--sections` in llvm-readobj and `-s` as an alias for `--symbols` in llvm-readelf. There is no need to have a separate test for such things. The test for the `-s` alias for `--sections` can be included into the `ELF\sections.test`. And the test for `-s` for llvm-readelf is already included into `ELF\symbols.test`. So, this patch: 1) Removes `Object/readobj-shared-object.test`. 2) Removes `ELF\readelf-s-alias.test` 3) Rewrites the `ELF\sections.test`. 4) Removes ELF/Inputs/trivial.obj.elf-mipsel. Differential revision: https://reviews.llvm.org/D73686
123 lines
3.5 KiB
Plaintext
123 lines
3.5 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 --docnum=1 %s -o %t64
|
|
# RUN: llvm-readobj --sections %t64 | FileCheck %s --check-prefixes=ELF,ELF64
|
|
# RUN: yaml2obj --docnum=2 %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: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_X86_64
|
|
Sections:
|
|
- Name: .foo
|
|
Type: SHT_PROGBITS
|
|
Info: 1
|
|
Address: 0x2
|
|
Size: 0x3
|
|
Flags: [ SHF_WRITE, SHF_ALLOC ]
|
|
Link: 4
|
|
AddressAlign: 5
|
|
EntSize: 6
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_386
|
|
Sections:
|
|
- Name: .foo
|
|
Type: SHT_PROGBITS
|
|
Info: 1
|
|
Address: 0x2
|
|
Size: 0x3
|
|
Flags: [ SHF_WRITE, SHF_ALLOC ]
|
|
Link: 4
|
|
AddressAlign: 5
|
|
EntSize: 6
|