relr-relocs.test 6.33 KB
## This is a test to test how SHT_RELR sections are dumped.

# RUN: yaml2obj --docnum=1 %s \
# RUN:   | llvm-readobj --relocations --raw-relr - \
# RUN:   | FileCheck --check-prefix=RAW-LLVM1 %s
# RAW-LLVM1:      Section (1) .relr.dyn {
# RAW-LLVM1-NEXT:   0x10D60
# RAW-LLVM1-NEXT:   0x103
# RAW-LLVM1-NEXT:   0x20000
# RAW-LLVM1-NEXT:   0xF0501
# RAW-LLVM1-NEXT:   0xA700550400009
# RAW-LLVM1-NEXT: }

# RUN: yaml2obj --docnum=1 %s \
# RUN:   | llvm-readobj --relocations - \
# RUN:   | FileCheck --check-prefix=LLVM1 %s
# LLVM1:      Section (1) .relr.dyn {
# LLVM1-NEXT:   0x10D60 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x10D68 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x10DA0 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20000 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20040 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20050 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20080 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20088 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20090 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20098 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20210 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x202A8 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x202D8 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x202E8 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x202F8 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20308 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20358 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20360 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20368 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20380 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20390 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT: }

# RUN: yaml2obj --docnum=1 %s \
# RUN:   | llvm-readelf -relocations -raw-relr - \
# RUN:   | FileCheck --check-prefix=RAW-GNU1 %s
# RAW-GNU1:      Relocation section '.relr.dyn' at offset 0x40 contains 5 entries:
# RAW-GNU1:      0000000000010d60
# RAW-GNU1-NEXT: 0000000000000103
# RAW-GNU1-NEXT: 0000000000020000
# RAW-GNU1-NEXT: 00000000000f0501
# RAW-GNU1-NEXT: 000a700550400009

# RUN: yaml2obj --docnum=1 %s \
# RUN:   | llvm-readelf -relocations - \
# RUN:   | FileCheck --check-prefix=GNU1 %s
# GNU1:      Relocation section '.relr.dyn' at offset 0x40 contains 21 entries:
# GNU1:      0000000000010d60  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000010d68  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000010da0  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020000  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020040  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020050  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020080  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020088  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020090  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020098  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020210  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 00000000000202a8  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 00000000000202d8  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 00000000000202e8  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 00000000000202f8  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020308  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020358  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020360  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020368  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020380  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020390  0000000000000008 R_X86_64_RELATIVE

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_DYN
  Machine: EM_X86_64

Sections:
  - Name:  .relr.dyn
    Type:  SHT_RELR
    Flags: [ SHF_ALLOC ]
    Entries: [ 0x0000000000010D60, 0x0000000000000103, 0x0000000000020000,
               0x00000000000F0501, 0x000A700550400009 ]

# RUN: yaml2obj --docnum=2 %s \
# RUN:   | llvm-readobj --relocations --raw-relr - \
# RUN:   | FileCheck --check-prefix=RAW-LLVM2 %s
# RAW-LLVM2:      Section (1) .relr.dyn {
# RAW-LLVM2-NEXT:   0x10D60
# RAW-LLVM2-NEXT:   0x103
# RAW-LLVM2-NEXT:   0x20000
# RAW-LLVM2-NEXT:   0xF0501
# RAW-LLVM2-NEXT:   0x50400009
# RAW-LLVM2-NEXT: }

# RUN: yaml2obj --docnum=2 %s \
# RUN:   | llvm-readobj --relocations - \
# RUN:   | FileCheck --check-prefix=LLVM2 %s
# LLVM2:      Section (1) .relr.dyn {
# LLVM2-NEXT:   0x10D60 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x10D64 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x10D80 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20000 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20020 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20028 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20040 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20044 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20048 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x2004C R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20088 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x200D4 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x200EC R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x200F4 R_386_RELATIVE - 0x0
# LLVM2-NEXT: }

# RUN: yaml2obj --docnum=2 %s \
# RUN:   | llvm-readelf -relocations -raw-relr - \
# RUN:   | FileCheck --check-prefix=RAW-GNU2 %s
# RAW-GNU2:      Relocation section '.relr.dyn' at offset 0x34 contains 5 entries:
# RAW-GNU2:      00010d60
# RAW-GNU2-NEXT: 00000103
# RAW-GNU2-NEXT: 00020000
# RAW-GNU2-NEXT: 000f0501
# RAW-GNU2-NEXT: 50400009

# RUN: yaml2obj --docnum=2 %s \
# RUN:   | llvm-readelf -relocations - \
# RUN:   | FileCheck --check-prefix=GNU2 %s
# GNU2:      Relocation section '.relr.dyn' at offset 0x34 contains 14 entries:
# GNU2:      00010d60  00000008 R_386_RELATIVE
# GNU2-NEXT: 00010d64  00000008 R_386_RELATIVE
# GNU2-NEXT: 00010d80  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020000  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020020  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020028  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020040  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020044  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020048  00000008 R_386_RELATIVE
# GNU2-NEXT: 0002004c  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020088  00000008 R_386_RELATIVE
# GNU2-NEXT: 000200d4  00000008 R_386_RELATIVE
# GNU2-NEXT: 000200ec  00000008 R_386_RELATIVE
# GNU2-NEXT: 000200f4  00000008 R_386_RELATIVE

--- !ELF
FileHeader:
  Class:   ELFCLASS32
  Data:    ELFDATA2LSB
  Type:    ET_DYN
  Machine: EM_386

Sections:
  - Name:  .relr.dyn
    Type:  SHT_RELR
    Flags: [ SHF_ALLOC ]
    Entries: [ 0x00010D60, 0x00000103, 0x00020000,
               0x000F0501, 0x50400009 ]