no-symbol-reloc.test 1.25 KB
## Check yaml2obj is able to dump relocations
## that have no or a zero symbol associated.

# RUN: yaml2obj %s -o %t.o
# RUN: obj2yaml %t.o | FileCheck %s

# CHECK:      --- !ELF
# CHECK-NEXT: FileHeader:
# CHECK-NEXT:   Class:   ELFCLASS64
# CHECK-NEXT:   Data:    ELFDATA2LSB
# CHECK-NEXT:   Type:    ET_REL
# CHECK-NEXT:   Machine: EM_X86_64
# CHECK-NEXT: Sections:
# CHECK-NEXT:   - Name:    .text
# CHECK-NEXT:     Type:    SHT_PROGBITS
# CHECK-NEXT:     Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
# CHECK-NEXT:   - Name:    .rela.text
# CHECK-NEXT:     Type:    SHT_RELA
# CHECK-NEXT:     EntSize: 0x0000000000000018
# CHECK-NEXT:     Info:    .text
# CHECK-NEXT:     Relocations:
# CHECK-NEXT:       - Offset: 0x0000000000000000
# CHECK-NEXT:         Type:   R_X86_64_NONE
# CHECK-NEXT:       - Offset: 0x0000000000000004
# CHECK-NEXT:         Type:   R_X86_64_NONE
# CHECK-NEXT: ...

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64
Sections:
  - Name:  .text
    Type:  SHT_PROGBITS
    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
  - Name:  .rela.text
    Type:  SHT_RELA
    Info:  .text
    Relocations:
      - Offset: 0x0
        Type:   R_X86_64_NONE
      - Offset: 0x4
        Type:   R_X86_64_NONE
        Symbol: 0