section-flags.test 5.28 KB
## 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: ]

# LLVM:      Name: write
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0x1)
# LLVM-NEXT:   SHF_WRITE (0x1)
# LLVM-NEXT: ]

# LLVM:      Name: alloc
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0x2)
# LLVM-NEXT:   SHF_ALLOC (0x2)
# LLVM-NEXT: ]

# LLVM:      Name: exec
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0x4)
# LLVM-NEXT:   SHF_EXECINSTR (0x4)
# LLVM-NEXT: ]

# LLVM:      Name: merge
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0x10)
# LLVM-NEXT:   SHF_MERGE (0x10)
# LLVM-NEXT: ]

# LLVM:      Name: strings
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0x20)
# LLVM-NEXT:   SHF_STRINGS (0x20)
# LLVM-NEXT: ]

# LLVM:      Name: infolink
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0x40)
# LLVM-NEXT:   SHF_INFO_LINK (0x40)
# LLVM-NEXT: ]

# LLVM:      Name: linkorder
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0x80)
# LLVM-NEXT:   SHF_LINK_ORDER (0x80)
# LLVM-NEXT: ]

# LLVM:      Name: nonconforming
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0x100)
# LLVM-NEXT:   SHF_OS_NONCONFORMING (0x100)
# LLVM-NEXT: ]

# LLVM:      Name: group
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0x200)
# LLVM-NEXT:   SHF_GROUP (0x200)
# LLVM-NEXT: ]

# LLVM:      Name: tls
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0x400)
# LLVM-NEXT:   SHF_TLS (0x400)
# LLVM-NEXT: ]

# LLVM:      Name: compressed
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0x800)
# LLVM-NEXT:   SHF_COMPRESSED (0x800)
# LLVM-NEXT: ]

# LLVM:      Name: exclude
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0x80000000)
# LLVM-NEXT:   SHF_EXCLUDE (0x80000000)
# LLVM-NEXT: ]

# LLVM:      Name: unknown
# LLVM-NEXT: Type: SHT_PROGBITS
# LLVM-NEXT: Flags [ (0xF0000)
# LLVM-NEXT: ]

# GNU: [Nr] Name          Type     Address          Off    Size   ES Flg          Lk Inf Al
# GNU: [ 1] allflags      PROGBITS 0000000000000000 000040 000000 00 WAXMSILOGTCE 0   0  0
# GNU: [ 2] noflags       PROGBITS 0000000000000000 000040 000000 00              0   0  0
# GNU: [ 3] write         PROGBITS 0000000000000000 000040 000000 00 W            0   0  0
# GNU: [ 4] alloc         PROGBITS 0000000000000000 000040 000000 00 A            0   0  0
# GNU: [ 5] exec          PROGBITS 0000000000000000 000040 000000 00 X            0   0  0
# GNU: [ 6] merge         PROGBITS 0000000000000000 000040 000000 00 M            0   0  0
# GNU: [ 7] strings       PROGBITS 0000000000000000 000040 000000 00 S            0   0  0
# GNU: [ 8] infolink      PROGBITS 0000000000000000 000040 000000 00 I            0   0  0
# GNU: [ 9] linkorder     PROGBITS 0000000000000000 000040 000000 00 L            0   0  0
# GNU: [10] nonconforming PROGBITS 0000000000000000 000040 000000 00 O            0   0  0
# GNU: [11] group         PROGBITS 0000000000000000 000040 000000 00 G            0   0  0
# GNU: [12] tls           PROGBITS 0000000000000000 000040 000000 00 T            0   0  0
# GNU: [13] compressed    PROGBITS 0000000000000000 000040 000000 00 C            0   0  0
# GNU: [14] exclude       PROGBITS 0000000000000000 000040 000000 00 E            0   0  0
# GNU: [15] unknown       PROGBITS 0000000000000000 000040 000000 00 x            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: [ ]
  - Name:  write
    Type:  SHT_PROGBITS
    Flags: [ SHF_WRITE ]
  - Name:  alloc
    Type:  SHT_PROGBITS
    Flags: [ SHF_ALLOC ]
  - Name:  exec
    Type:  SHT_PROGBITS
    Flags: [ SHF_EXECINSTR ]
  - Name:  merge
    Type:  SHT_PROGBITS
    Flags: [ SHF_MERGE ]
  - Name:  strings
    Type:  SHT_PROGBITS
    Flags: [ SHF_STRINGS ]
  - Name:  infolink
    Type:  SHT_PROGBITS
    Flags: [ SHF_INFO_LINK ]
  - Name:  linkorder
    Type:  SHT_PROGBITS
    Flags: [ SHF_LINK_ORDER ]
  - Name:  nonconforming
    Type:  SHT_PROGBITS
    Flags: [ SHF_OS_NONCONFORMING ]
  - Name:  group
    Type:  SHT_PROGBITS
    Flags: [ SHF_GROUP ]
  - Name:  tls
    Type:  SHT_PROGBITS
    Flags: [ SHF_TLS ]
  - Name:  compressed
    Type:  SHT_PROGBITS
    Flags: [ SHF_COMPRESSED ]
  - Name:  exclude
    Type:  SHT_PROGBITS
    Flags: [ SHF_EXCLUDE ]
  - Name:  unknown
    Type:  SHT_PROGBITS
    ShFlags: 0x000f0000