File: elf-disassemble-relocs.test

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,388 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (42 lines) | stat: -rw-r--r-- 1,187 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
## Show that --disassemble + --reloc prints relocations inline and does not dump
## the relocation sections.

# RUN: yaml2obj %s -o %t.o
# RUN: llvm-objdump %t.o -d -r | FileCheck %s --implicit-check-not="RELOCATION RECORDS"

# CHECK:      0: e8 00 00 00 00                callq   0 <.text+0x5>
# CHECK-NEXT:          0000000000000001:  R_X86_64_PC32        foo-4
# CHECK-NEXT:          0000000000000002:  R_X86_64_NONE        bar+8
# CHECK-NEXT: 5: e8 00 00 00 00                callq   0 <.text+0xa>
# CHECK-NEXT:          0000000000000006:  R_X86_64_PLT32       foo+1

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64
Sections:
  - Name:    .text
    Type:    SHT_PROGBITS
    Flags:   [SHF_ALLOC, SHF_EXECINSTR]
    Content: 'e800000000e800000000'
  - Name:    .rela.text
    Type:    SHT_RELA
    Info:    .text
    Relocations:
      - Offset: 1
        Symbol: foo
        Type:   R_X86_64_PC32
        Addend: -4
      - Offset: 2
        Symbol: bar
        Type:   R_X86_64_NONE
        Addend: 8
      - Offset: 6
        Symbol: foo
        Type:   R_X86_64_PLT32
        Addend: 1
Symbols:
  - Name: foo
  - Name: bar