brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · a6bd09c Raw
103 lines · plain
1## Show that --disassemble + --reloc prints relocations inline and does not dump2## the relocation sections.3 4# RUN: rm -rf %t && split-file %s %t && cd %t5# RUN: llvm-mc -filetype=obj -triple=x86_64 1.s -o 1.o6# RUN: llvm-objdump 1.o -d -r | FileCheck %s --implicit-check-not="RELOCATION RECORDS"7# RUN: llvm-objdump 1.o -r --disassemble-symbols=x2,x4 | FileCheck %s --check-prefix=CHECK28 9# RUN: llvm-mc -filetype=obj -triple=x86_64 -crel 1.s -o 1leb.o10# RUN: llvm-objdump 1leb.o -d -r | FileCheck %s --implicit-check-not="RELOCATION RECORDS"11# RUN: llvm-objdump 1leb.o -r --disassemble-symbols=x2,x4 | FileCheck %s --check-prefix=CHECK212 13#--- 1.s14# CHECK:       0000000000000000 <x1>:15# CHECK-NEXT:    0: e8 00 00 00 00                callq   0x5 <x1+0x5>16# CHECK-NEXT:             0000000000000001:  R_X86_64_PC32        foo-0x417# CHECK-NEXT:             0000000000000002:  R_X86_64_NONE        bar+0x818# CHECK-NEXT:    5: e8 00 00 00 00                callq   0xa <x2>19# CHECK-NEXT:             0000000000000006:  R_X86_64_PLT32       foo+0x120# CHECK-EMPTY:21# CHECK-NEXT:  000000000000000a <x2>:22# CHECK-NEXT:    a: 90                            nop23# CHECK-NEXT:    b: 48 8b 05 00 00 00 00          movq    (%rip), %rax            # 0x12 <x3>24# CHECK-NEXT:             000000000000000e:  R_X86_64_REX_GOTPCRELX       var-0x425# CHECK-EMPTY:26# CHECK-NEXT:  0000000000000012 <x3>:27# CHECK-NEXT:   12: e8 00 00 00 00                callq   0x17 <x4>28# CHECK-NEXT:             0000000000000013:  R_X86_64_PLT32       foo-0x429# CHECK-EMPTY:30# CHECK-NEXT:  0000000000000017 <x4>:31# CHECK-NEXT:   17: 48 8b 05 00 00 00 00          movq    (%rip), %rax            # 0x1e <x4+0x7>32# CHECK-NEXT:             000000000000001a:  R_X86_64_REX_GOTPCRELX       var-0x433# CHECK-NOT:   {{.}}34 35# CHECK2:      000000000000000a <x2>:36# CHECK2-NEXT:   a: 90                            nop37# CHECK2-NEXT:   b: 48 8b 05 00 00 00 00          movq    (%rip), %rax            # 0x12 <x3>38# CHECK2-NEXT:           000000000000000e:  R_X86_64_REX_GOTPCRELX       var-0x439# CHECK2-EMPTY:40# CHECK2-NEXT: 0000000000000017 <x4>:41# CHECK2-NEXT:  17: 48 8b 05 00 00 00 00          movq    (%rip), %rax            # 0x1e <x4+0x7>42# CHECK2-NEXT:            000000000000001a:  R_X86_64_REX_GOTPCRELX       var-0x443# CHECK2-NOT:  {{.}}44 45.globl x1, x2, x3, x446x1:47  .reloc .+1, R_X86_64_PC32, foo-448  .reloc .+2, BFD_RELOC_NONE, bar+849  .byte 0xe8, 0, 0, 0, 050  .reloc .+1, R_X86_64_PLT32, foo+151  .byte 0xe8, 0, 0, 0, 052 53x2:54  nop55  movq var@GOTPCREL(%rip), %rax56 57x3:58  call foo59 60x4:61  movq var@GOTPCREL(%rip), %rax62 63#--- 2.yaml64## Check we report an error if the relocated section identified by the65## sh_info field of a relocation section is invalid.66 67# RUN: yaml2obj 2.yaml -o 2.o68# RUN: not llvm-objdump 2.o -d --reloc 2>&1 | FileCheck %s --check-prefix=ERR69 70# ERR: error: '2.o': section (1): failed to get a relocated section: invalid section index: 25571 72--- !ELF73FileHeader:74  Class:   ELFCLASS6475  Data:    ELFDATA2LSB76  Type:    ET_REL77  Machine: EM_X86_6478Sections:79- Name: .rela.debug_info80  Type: SHT_RELA81  Link: 082  Info: 0xFF83  Relocations: []84 85#--- 3.s86## Check ranges of addends being displayed in a dump of relocations mixed with disassembly.87# RUN: llvm-mc -filetype=obj -triple=x86_64 3.s -o 3.o88# RUN: llvm-objdump -d -r 3.o | FileCheck %s --check-prefix=ADDENDS89 90# ADDENDS: Disassembly of section .text:91# ADDENDS: R_X86_64_64 glob-0x800000000000000092# ADDENDS: R_X86_64_64 glob+0x7fffffffffffffff93# ADDENDS: R_X86_64_64 glob-0x194# ADDENDS: R_X86_64_64 glob+0x1234567895# ADDENDS: R_X86_64_64 glob{{$}}96 97.reloc ., BFD_RELOC_64, glob-0x800000000000000098.reloc .+1, BFD_RELOC_64, glob+0x7fffffffffffffff99.reloc .+2, BFD_RELOC_64, glob-1100.reloc .+3, BFD_RELOC_64, glob+0x12345678101.reloc .+4, BFD_RELOC_64, glob102.space 8103