relocations-in-nonreloc.test 1.37 KB
## Check that objdump doesn't print relocations in non-relocatable object files.

# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-objdump -r %t1 | FileCheck %s -DFILE=%t1 --check-prefix=FMT --implicit-check-not={{.}}
# RUN: yaml2obj --docnum=2 %s -o %t2
# RUN: llvm-objdump -r %t2 | FileCheck %s -DFILE=%t2 --check-prefix=FMT --implicit-check-not={{.}}
# RUN: yaml2obj --docnum=3 %s -o %t3
# RUN: llvm-objdump -r %t3 | FileCheck %s -DFILE=%t3 --check-prefixes=FMT,REL --implicit-check-not={{.}}

# FMT: [[FILE]]: file format ELF64-x86-64

# REL:      RELOCATION RECORDS FOR []:
# REL-NEXT: 0000000000000123 R_X86_64_NONE *ABS*+0x141

## Executable.
--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Sections:
  - Name: .rela.plt
    Type: SHT_RELA
    Relocations:
      - Offset: 0x123
        Type:   R_X86_64_NONE
        Addend: 321

## DSO.
--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_DYN
  Machine: EM_X86_64
Sections:
  - Name: .rela.plt
    Type: SHT_RELA
    Relocations:
      - Offset: 0x123
        Type:   R_X86_64_NONE
        Addend: 321

## Relocatable.
--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64
Sections:
  - Name: .rela.plt
    Type: SHT_RELA
    Relocations:
      - Offset: 0x123
        Type:   R_X86_64_NONE
        Addend: 321