llvm.org GIT mirror llvm / 785cf2e test / tools / llvm-readobj / reloc-types-elf-x64.test
785cf2e

Tree @785cf2e (Download .tar.gz)

reloc-types-elf-x64.test @785cf2eraw · history · blame

## Test that llvm-readobj/llvm-readelf shows proper relocation type
## names and values for x86_64 target.

# RUN: yaml2obj %s -o %t-x86_64.o
# RUN: llvm-readobj -r --expand-relocs %t-x86_64.o | FileCheck %s --check-prefix=LLVM
# RUN: llvm-readelf -r --expand-relocs %t-x86_64.o | FileCheck %s --check-prefix=GNU

# LLVM: Type: R_X86_64_NONE (0)
# LLVM: Type: R_X86_64_64 (1)
# LLVM: Type: R_X86_64_PC32 (2)
# LLVM: Type: R_X86_64_GOT32 (3)
# LLVM: Type: R_X86_64_PLT32 (4)
# LLVM: Type: R_X86_64_COPY (5)
# LLVM: Type: R_X86_64_GLOB_DAT (6)
# LLVM: Type: R_X86_64_JUMP_SLOT (7)
# LLVM: Type: R_X86_64_RELATIVE (8)
# LLVM: Type: R_X86_64_GOTPCREL (9)
# LLVM: Type: R_X86_64_32 (10)
# LLVM: Type: R_X86_64_32S (11)
# LLVM: Type: R_X86_64_16 (12)
# LLVM: Type: R_X86_64_PC16 (13)
# LLVM: Type: R_X86_64_8 (14)
# LLVM: Type: R_X86_64_PC8 (15)
# LLVM: Type: R_X86_64_DTPMOD64 (16)
# LLVM: Type: R_X86_64_DTPOFF64 (17)
# LLVM: Type: R_X86_64_TPOFF64 (18)
# LLVM: Type: R_X86_64_TLSGD (19)
# LLVM: Type: R_X86_64_TLSLD (20)
# LLVM: Type: R_X86_64_DTPOFF32 (21)
# LLVM: Type: R_X86_64_GOTTPOFF (22)
# LLVM: Type: R_X86_64_TPOFF32 (23)
# LLVM: Type: R_X86_64_PC64 (24)
# LLVM: Type: R_X86_64_GOTOFF64 (25)
# LLVM: Type: R_X86_64_GOTPC32 (26)
# LLVM: Type: R_X86_64_GOT64 (27)
# LLVM: Type: R_X86_64_GOTPCREL64 (28)
# LLVM: Type: R_X86_64_GOTPC64 (29)
# LLVM: Type: R_X86_64_GOTPLT64 (30)
# LLVM: Type: R_X86_64_PLTOFF64 (31)
# LLVM: Type: R_X86_64_SIZE32 (32)
# LLVM: Type: R_X86_64_SIZE64 (33)
# LLVM: Type: R_X86_64_GOTPC32_TLSDESC (34)
# LLVM: Type: R_X86_64_TLSDESC_CALL (35)
# LLVM: Type: R_X86_64_TLSDESC (36)
# LLVM: Type: R_X86_64_IRELATIVE (37)
# LLVM: Type: R_X86_64_GOTPCRELX (41)
# LLVM: Type: R_X86_64_REX_GOTPCRELX (42)

# GNU:      Relocation section '.rela.text' at offset 0x1c8 contains 40 entries:
# GNU-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
# GNU-NEXT: 0000000000000003  0000000100000000 R_X86_64_NONE          0000000000000000 foo + 0
# GNU-NEXT: 000000000000000a  0000000100000001 R_X86_64_64            0000000000000000 foo + 0
# GNU-NEXT: 0000000000000011  0000000100000002 R_X86_64_PC32          0000000000000000 foo + 0
# GNU-NEXT: 0000000000000018  0000000100000003 R_X86_64_GOT32         0000000000000000 foo + 0
# GNU-NEXT: 000000000000001f  0000000100000004 R_X86_64_PLT32         0000000000000000 foo + 0
# GNU-NEXT: 0000000000000026  0000000100000005 R_X86_64_COPY          0000000000000000 foo + 0
# GNU-NEXT: 000000000000002d  0000000100000006 R_X86_64_GLOB_DAT      0000000000000000 foo + 0
# GNU-NEXT: 0000000000000034  0000000100000007 R_X86_64_JUMP_SLOT     0000000000000000 foo + 0
# GNU-NEXT: 000000000000003b  0000000100000008 R_X86_64_RELATIVE      0000000000000000 foo + 0
# GNU-NEXT: 0000000000000042  0000000100000009 R_X86_64_GOTPCREL      0000000000000000 foo + 0
# GNU-NEXT: 0000000000000049  000000010000000a R_X86_64_32            0000000000000000 foo + 0
# GNU-NEXT: 0000000000000050  000000010000000b R_X86_64_32S           0000000000000000 foo + 0
# GNU-NEXT: 0000000000000057  000000010000000c R_X86_64_16            0000000000000000 foo + 0
# GNU-NEXT: 000000000000005e  000000010000000d R_X86_64_PC16          0000000000000000 foo + 0
# GNU-NEXT: 0000000000000065  000000010000000e R_X86_64_8             0000000000000000 foo + 0
# GNU-NEXT: 000000000000006c  000000010000000f R_X86_64_PC8           0000000000000000 foo + 0
# GNU-NEXT: 0000000000000073  0000000100000010 R_X86_64_DTPMOD64      0000000000000000 foo + 0
# GNU-NEXT: 000000000000007a  0000000100000011 R_X86_64_DTPOFF64      0000000000000000 foo + 0
# GNU-NEXT: 0000000000000081  0000000100000012 R_X86_64_TPOFF64       0000000000000000 foo + 0
# GNU-NEXT: 0000000000000088  0000000100000013 R_X86_64_TLSGD         0000000000000000 foo + 0
# GNU-NEXT: 000000000000008f  0000000100000014 R_X86_64_TLSLD         0000000000000000 foo + 0
# GNU-NEXT: 0000000000000096  0000000100000015 R_X86_64_DTPOFF32      0000000000000000 foo + 0
# GNU-NEXT: 000000000000009d  0000000100000016 R_X86_64_GOTTPOFF      0000000000000000 foo + 0
# GNU-NEXT: 00000000000000a4  0000000100000017 R_X86_64_TPOFF32       0000000000000000 foo + 0
# GNU-NEXT: 00000000000000ab  0000000100000018 R_X86_64_PC64          0000000000000000 foo + 0
# GNU-NEXT: 00000000000000b2  0000000100000019 R_X86_64_GOTOFF64      0000000000000000 foo + 0
# GNU-NEXT: 00000000000000b9  000000010000001a R_X86_64_GOTPC32       0000000000000000 foo + 0
# GNU-NEXT: 00000000000000c0  000000010000001b R_X86_64_GOT64         0000000000000000 foo + 0
# GNU-NEXT: 00000000000000c7  000000010000001c R_X86_64_GOTPCREL64    0000000000000000 foo + 0
# GNU-NEXT: 00000000000000ce  000000010000001d R_X86_64_GOTPC64       0000000000000000 foo + 0
# GNU-NEXT: 00000000000000d5  000000010000001e R_X86_64_GOTPLT64      0000000000000000 foo + 0
# GNU-NEXT: 00000000000000dc  000000010000001f R_X86_64_PLTOFF64      0000000000000000 foo + 0
# GNU-NEXT: 00000000000000e3  0000000100000020 R_X86_64_SIZE32        0000000000000000 foo + 0
# GNU-NEXT: 00000000000000ea  0000000100000021 R_X86_64_SIZE64        0000000000000000 foo + 0
# GNU-NEXT: 00000000000000f1  0000000100000022 R_X86_64_GOTPC32_TLSDESC 0000000000000000 foo + 0
# GNU-NEXT: 00000000000000f8  0000000100000023 R_X86_64_TLSDESC_CALL  0000000000000000 foo + 0
# GNU-NEXT: 00000000000000ff  0000000100000024 R_X86_64_TLSDESC       0000000000000000 foo + 0
# GNU-NEXT: 0000000000000106  0000000100000025 R_X86_64_IRELATIVE     0000000000000000 foo + 0
# GNU-NEXT: 000000000000010a  0000000100000029 R_X86_64_GOTPCRELX     0000000000000000 foo + 0
# GNU-NEXT: 000000000000010e  000000010000002a R_X86_64_REX_GOTPCRELX 0000000000000000 foo + 0

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  OSABI:   ELFOSABI_GNU
  Type:    ET_REL
  Machine: EM_X86_64
Sections:
  - Name:    .text
    Type:    SHT_PROGBITS
    Content: 00
  - Name:         .rela.text
    Type:         SHT_RELA
    Link:         .symtab
    AddressAlign: 0x0000000000000008
    EntSize:      0x0000000000000018
    Info:         .text
    Relocations:
      - Offset: 0x0000000000000003
        Type:   R_X86_64_NONE
        Symbol: foo
      - Offset: 0x000000000000000A
        Type:   R_X86_64_64
        Symbol: foo
      - Offset: 0x0000000000000011
        Type:   R_X86_64_PC32
        Symbol: foo
      - Offset: 0x0000000000000018
        Type:   R_X86_64_GOT32
        Symbol: foo
      - Offset: 0x000000000000001F
        Type:   R_X86_64_PLT32
        Symbol: foo
      - Offset: 0x0000000000000026
        Type:   R_X86_64_COPY
        Symbol: foo
      - Offset: 0x000000000000002D
        Type:   R_X86_64_GLOB_DAT
        Symbol: foo
      - Offset: 0x0000000000000034
        Type:   R_X86_64_JUMP_SLOT
        Symbol: foo
      - Offset: 0x000000000000003B
        Type:   R_X86_64_RELATIVE
        Symbol: foo
      - Offset: 0x0000000000000042
        Type:   R_X86_64_GOTPCREL
        Symbol: foo
      - Offset: 0x0000000000000049
        Type:   R_X86_64_32
        Symbol: foo
      - Offset: 0x0000000000000050
        Type:   R_X86_64_32S
        Symbol: foo
      - Offset: 0x0000000000000057
        Type:   R_X86_64_16
        Symbol: foo
      - Offset: 0x000000000000005E
        Type:   R_X86_64_PC16
        Symbol: foo
      - Offset: 0x0000000000000065
        Type:   R_X86_64_8
        Symbol: foo
      - Offset: 0x000000000000006C
        Type:   R_X86_64_PC8
        Symbol: foo
      - Offset: 0x0000000000000073
        Type:   R_X86_64_DTPMOD64
        Symbol: foo
      - Offset: 0x000000000000007A
        Type:   R_X86_64_DTPOFF64
        Symbol: foo
      - Offset: 0x0000000000000081
        Type:   R_X86_64_TPOFF64
        Symbol: foo
      - Offset: 0x0000000000000088
        Type:   R_X86_64_TLSGD
        Symbol: foo
      - Offset: 0x000000000000008F
        Type:   R_X86_64_TLSLD
        Symbol: foo
      - Offset: 0x0000000000000096
        Type:   R_X86_64_DTPOFF32
        Symbol: foo
      - Offset: 0x000000000000009D
        Type:   R_X86_64_GOTTPOFF
        Symbol: foo
      - Offset: 0x00000000000000A4
        Type:   R_X86_64_TPOFF32
        Symbol: foo
      - Offset: 0x00000000000000AB
        Type:   R_X86_64_PC64
        Symbol: foo
      - Offset: 0x00000000000000B2
        Type:   R_X86_64_GOTOFF64
        Symbol: foo
      - Offset: 0x00000000000000B9
        Type:   R_X86_64_GOTPC32
        Symbol: foo
      - Offset: 0x00000000000000C0
        Type:   R_X86_64_GOT64
        Symbol: foo
      - Offset: 0x00000000000000C7
        Type:   R_X86_64_GOTPCREL64
        Symbol: foo
      - Offset: 0x00000000000000CE
        Type:   R_X86_64_GOTPC64
        Symbol: foo
      - Offset: 0x00000000000000D5
        Type:   R_X86_64_GOTPLT64
        Symbol: foo
      - Offset: 0x00000000000000DC
        Type:   R_X86_64_PLTOFF64
        Symbol: foo
      - Offset: 0x00000000000000E3
        Type:   R_X86_64_SIZE32
        Symbol: foo
      - Offset: 0x00000000000000EA
        Type:   R_X86_64_SIZE64
        Symbol: foo
      - Offset: 0x00000000000000F1
        Type:   R_X86_64_GOTPC32_TLSDESC
        Symbol: foo
      - Offset: 0x00000000000000F8
        Type:   R_X86_64_TLSDESC_CALL
        Symbol: foo
      - Offset: 0x00000000000000FF
        Type:   R_X86_64_TLSDESC
        Symbol: foo
      - Offset: 0x0000000000000106
        Type:   R_X86_64_IRELATIVE
        Symbol: foo
      - Offset: 0x000000000000010A
        Type:   R_X86_64_GOTPCRELX
        Symbol: foo
      - Offset: 0x000000000000010E
        Type:   R_X86_64_REX_GOTPCRELX
        Symbol: foo
Symbols:
  - Name:    foo
    Binding: STB_GLOBAL