forked from OSchip/llvm-project
[llvm-readobj][test] - Add a test for testing regular section flags and cleanup flags testing.
This: 1) Adds a test for testing all section flags (`section-flags.test`). 2) Renames `sec-flags.test`->`section-arch-flags.test` and performs a clean up. 3) Removes `compression.zlib.style.elf-x86-64` binary and a test case for SHF_COMPRESSED flag, because them are now excessive. 4) Adds missing MIPS flags and a test for SHF_ARM_PURECODE. Differential revision: https://reviews.llvm.org/D71333
This commit is contained in:
parent
e39cb48cd0
commit
c752de0505
Binary file not shown.
|
@ -1,9 +0,0 @@
|
|||
RUN: llvm-readobj --sections \
|
||||
RUN: %p/Inputs/compression.zlib.style.elf-x86-64 | FileCheck %s
|
||||
|
||||
CHECK: Section {
|
||||
CHECK: Name: .debug_info
|
||||
CHECK-NEXT: Type: SHT_PROGBITS
|
||||
CHECK-NEXT: Flags [
|
||||
CHECK-NEXT: SHF_COMPRESSED (0x800)
|
||||
CHECK-NEXT: ]
|
|
@ -1,67 +0,0 @@
|
|||
# Check that llvm-readobj shows arch specific ELF section flags.
|
||||
|
||||
# RUN: yaml2obj -docnum 1 %s > %t-hex.o
|
||||
# RUN: llvm-readobj -S %t-hex.o | FileCheck -check-prefix=HEX %s
|
||||
|
||||
# HEX: Flags [ (0x10000000)
|
||||
# HEX-NEXT: SHF_HEX_GPREL (0x10000000)
|
||||
# HEX-NEXT: ]
|
||||
|
||||
# hex.o
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS32
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_HEXAGON
|
||||
Flags: []
|
||||
Sections:
|
||||
- Name: .hex
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [SHF_HEX_GPREL]
|
||||
Size: 4
|
||||
|
||||
# RUN: yaml2obj -docnum 2 %s > %t-mips.o
|
||||
# RUN: llvm-readobj -S %t-mips.o | FileCheck -check-prefix=MIPS %s
|
||||
|
||||
# MIPS: Flags [ (0x38000000)
|
||||
# MIPS-NEXT: SHF_MIPS_GPREL (0x10000000)
|
||||
# MIPS-NEXT: SHF_MIPS_MERGE (0x20000000)
|
||||
# MIPS-NEXT: SHF_MIPS_NOSTRIP (0x8000000)
|
||||
# MIPS-NEXT: ]
|
||||
|
||||
# mips.o
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS32
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_MIPS
|
||||
Flags: []
|
||||
Sections:
|
||||
- Name: .mips
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [SHF_MIPS_GPREL, SHF_MIPS_MERGE, SHF_MIPS_NOSTRIP]
|
||||
Size: 4
|
||||
|
||||
# RUN: yaml2obj -docnum 3 %s > %t-x86_64.o
|
||||
# RUN: llvm-readobj -S %t-x86_64.o | FileCheck -check-prefix=X86_64 %s
|
||||
|
||||
# X86_64: Flags [ (0x10000000)
|
||||
# X86_64-NEXT: SHF_X86_64_LARGE (0x10000000)
|
||||
# X86_64-NEXT: ]
|
||||
|
||||
# x86_64.o
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS64
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_X86_64
|
||||
Flags: []
|
||||
Sections:
|
||||
- Name: .x86_64
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [SHF_X86_64_LARGE]
|
||||
Size: 4
|
||||
...
|
|
@ -0,0 +1,100 @@
|
|||
## Check how we dump arch specific ELF section flags.
|
||||
|
||||
# RUN: yaml2obj --docnum 1 %s -o %t-hex.o
|
||||
# RUN: llvm-readobj -S %t-hex.o | FileCheck --check-prefix=HEX-LLVM %s
|
||||
# RUN: llvm-readelf -S %t-hex.o | FileCheck --check-prefix=HEX-GNU %s
|
||||
|
||||
# HEX-LLVM: Flags [ (0x10000000)
|
||||
# HEX-LLVM-NEXT: SHF_HEX_GPREL (0x10000000)
|
||||
# HEX-LLVM-NEXT: ]
|
||||
|
||||
# HEX-GNU: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
|
||||
# HEX-GNU: [ 1] .hex PROGBITS 00000000 000034 000000 00 p 0 0 0
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS32
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_HEXAGON
|
||||
Sections:
|
||||
- Name: .hex
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_HEX_GPREL ]
|
||||
|
||||
# RUN: yaml2obj --docnum 2 %s -o %t-mips.o
|
||||
# RUN: llvm-readobj -S %t-mips.o | FileCheck --check-prefix=MIPS-LLVM %s
|
||||
# RUN: llvm-readelf -S %t-mips.o | FileCheck --check-prefix=MIPS-GNU %s
|
||||
|
||||
# MIPS-GNU: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
|
||||
# MIPS-GNU: [ 1] .mips PROGBITS 00000000 000034 000000 00 Eop 0 0 0
|
||||
|
||||
# MIPS-LLVM: Flags [ (0xFF000000)
|
||||
# MIPS-LLVM-NEXT: SHF_EXCLUDE (0x80000000)
|
||||
## FIXME: we should not print SHF_MASKPROC, because it is a mask value.
|
||||
# MIPS-LLVM-NEXT: SHF_MASKPROC (0xF0000000)
|
||||
# MIPS-LLVM-NEXT: SHF_MIPS_ADDR (0x40000000)
|
||||
# MIPS-LLVM-NEXT: SHF_MIPS_GPREL (0x10000000)
|
||||
# MIPS-LLVM-NEXT: SHF_MIPS_LOCAL (0x4000000)
|
||||
# MIPS-LLVM-NEXT: SHF_MIPS_MERGE (0x20000000)
|
||||
# MIPS-LLVM-NEXT: SHF_MIPS_NAMES (0x2000000)
|
||||
# MIPS-LLVM-NEXT: SHF_MIPS_NODUPES (0x1000000)
|
||||
# MIPS-LLVM-NEXT: SHF_MIPS_NOSTRIP (0x8000000)
|
||||
# MIPS-LLVM-NEXT: SHF_MIPS_STRING (0x80000000)
|
||||
# MIPS-LLVM-NEXT: ]
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS32
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_MIPS
|
||||
Sections:
|
||||
- Name: .mips
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_MIPS_NODUPES, SHF_MIPS_NAMES, SHF_MIPS_LOCAL, SHF_MIPS_NOSTRIP,
|
||||
SHF_MIPS_GPREL, SHF_MIPS_MERGE, SHF_MIPS_ADDR, SHF_MIPS_STRING ]
|
||||
|
||||
# RUN: yaml2obj --docnum 3 %s -o %t-x86_64.o
|
||||
# RUN: llvm-readobj -S %t-x86_64.o | FileCheck --check-prefix=X86_64-LLVM %s
|
||||
# RUN: llvm-readelf -S %t-x86_64.o | FileCheck --check-prefix=X86_64-GNU %s
|
||||
|
||||
# X86_64-LLVM: Flags [ (0x10000000)
|
||||
# X86_64-LLVM-NEXT: SHF_X86_64_LARGE (0x10000000)
|
||||
# X86_64-LLVM-NEXT: ]
|
||||
|
||||
# X86_64-GNU: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
|
||||
# X86_64-GNU: [ 1] .x86_64 PROGBITS 0000000000000000 000040 000000 00 p 0 0 0
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS64
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_X86_64
|
||||
Sections:
|
||||
- Name: .x86_64
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_X86_64_LARGE ]
|
||||
|
||||
# RUN: yaml2obj --docnum 4 %s -o %t-arm.o
|
||||
# RUN: llvm-readobj -S %t-arm.o | FileCheck --check-prefix=ARM-LLVM %s
|
||||
# RUN: llvm-readelf -S %t-arm.o | FileCheck --check-prefix=ARM-GNU %s
|
||||
|
||||
# ARM-LLVM: Flags [ (0x20000000)
|
||||
# ARM-LLVM-NEXT: SHF_ARM_PURECODE (0x20000000)
|
||||
# ARM-LLVM-NEXT: ]
|
||||
|
||||
# ARM-GNU: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
|
||||
# ARM-GNU: [ 1] foo PROGBITS 0000000000000000 000040 000000 00 p 0 0 0
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS64
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_ARM
|
||||
Sections:
|
||||
- Name: foo
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_ARM_PURECODE ]
|
|
@ -0,0 +1,48 @@
|
|||
## Check how we dump regular ELF section flags.
|
||||
|
||||
# RUN: yaml2obj %s -o %t.o
|
||||
# RUN: llvm-readobj -S %t.o | FileCheck --check-prefix=LLVM %s
|
||||
# RUN: llvm-readelf -S %t.o | FileCheck --check-prefix=GNU %s
|
||||
|
||||
# LLVM: Name: allflags
|
||||
# LLVM-NEXT: Type: SHT_PROGBITS
|
||||
# LLVM-NEXT: Flags [ (0x80000FF7)
|
||||
# LLVM-NEXT: SHF_ALLOC (0x2)
|
||||
# LLVM-NEXT: SHF_COMPRESSED (0x800)
|
||||
# LLVM-NEXT: SHF_EXCLUDE (0x80000000)
|
||||
# LLVM-NEXT: SHF_EXECINSTR (0x4)
|
||||
# LLVM-NEXT: SHF_GROUP (0x200)
|
||||
# LLVM-NEXT: SHF_INFO_LINK (0x40)
|
||||
# LLVM-NEXT: SHF_LINK_ORDER (0x80)
|
||||
# LLVM-NEXT: SHF_MERGE (0x10)
|
||||
# LLVM-NEXT: SHF_OS_NONCONFORMING (0x100)
|
||||
# LLVM-NEXT: SHF_STRINGS (0x20)
|
||||
# LLVM-NEXT: SHF_TLS (0x400)
|
||||
# LLVM-NEXT: SHF_WRITE (0x1)
|
||||
# LLVM-NEXT: ]
|
||||
|
||||
# LLVM: Name: noflags
|
||||
# LLVM-NEXT: Type: SHT_PROGBITS
|
||||
# LLVM-NEXT: Flags [ (0x0)
|
||||
# LLVM-NEXT: ]
|
||||
|
||||
# GNU: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
|
||||
# GNU: [ 1] allflags PROGBITS 0000000000000000 000040 000000 00 WAEXMSILoGTx 0 0 0
|
||||
# GNU: [ 2] noflags PROGBITS 0000000000000000 000040 000000 00 0 0 0
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS64
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_X86_64
|
||||
Flags: []
|
||||
Sections:
|
||||
- Name: allflags
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_WRITE, SHF_ALLOC, SHF_EXECINSTR, SHF_MERGE,
|
||||
SHF_STRINGS, SHF_INFO_LINK, SHF_LINK_ORDER, SHF_OS_NONCONFORMING,
|
||||
SHF_GROUP, SHF_TLS, SHF_COMPRESSED, SHF_EXCLUDE ]
|
||||
- Name: noflags
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ ]
|
Loading…
Reference in New Issue