brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · f3f9008 Raw
93 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t && split-file %s %t && cd %t3# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o4# RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o5# RUN: ld.lld -shared -soname=b.so b.o -o b.so6 7# RUN: ld.lld a.o -o a8# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn a | FileCheck %s --check-prefix=DISASM9# RUN: llvm-readelf -r -s a | FileCheck %s10 11# CHECK:      Relocation section '.rela.dyn' at offset {{.*}} contains 3 entries:12# CHECK-NEXT:     Type13# CHECK-NEXT: {{0*}}[[#%x,O:]] [[#%x,]] R_X86_64_IRELATIVE  [[#%x,QUX:]]14# CHECK-NEXT: {{0*}}[[#O+8]]   [[#%x,]] R_X86_64_IRELATIVE15# CHECK-NEXT: {{0*}}[[#O+16]]  [[#%x,]] R_X86_64_IRELATIVE16 17# CHECK:                      0 NOTYPE  LOCAL  HIDDEN     [[#]] __rela_iplt_start18# CHECK-NEXT:                 0 NOTYPE  LOCAL  HIDDEN     [[#]] __rela_iplt_end19# CHECK-NEXT: {{0*}}[[#QUX]]  0 IFUNC   GLOBAL DEFAULT    [[#]] qux20 21# RUN: ld.lld -pie a.o b.so -o a122# RUN: llvm-readelf -rs a1 | FileCheck %s --check-prefixes=PIC,PIE23# RUN: ld.lld -shared a.o b.so -o a224# RUN: llvm-readelf -rs a2 | FileCheck %s --check-prefix=PIC25 26# PIC:      {{0*}}[[#%x,O:]] [[#%x,]] R_X86_64_RELATIVE27# PIC-NEXT:                           R_X86_64_GLOB_DAT      0000000000000000 ext + 028# PIC-NEXT: {{0*}}[[#O-16]]  [[#%x,]] R_X86_64_64            0000000000000000 __rela_iplt_start + 029# PIC-NEXT: {{0*}}[[#O-8]]   [[#%x,]] R_X86_64_64            0000000000000000 __rela_iplt_end + 030# PIE-NEXT: {{0*}}[[#O+8]]   [[#%x,]] R_X86_64_IRELATIVE31# PIE-NEXT: {{0*}}[[#O+16]]  [[#%x,]] R_X86_64_IRELATIVE32# PIE-NEXT: {{0*}}[[#O+24]]  [[#%x,]] R_X86_64_IRELATIVE33 34# PIC:        0 NOTYPE  WEAK   DEFAULT    UND __rela_iplt_start35# PIC-NEXT:   0 NOTYPE  WEAK   DEFAULT    UND __rela_iplt_end36 37# DISASM: Disassembly of section .text:38# DISASM-EMPTY:39# DISASM-NEXT: <qux>:40# DISASM:      <foo>:41# DISASM:      <bar>:42# DISASM:      <unused>:43# DISASM:      <_start>:44# DISASM-NEXT:   callq 0x[[#%x,foo:]]45# DISASM-NEXT:   callq 0x[[#%x,bar:]]46# DISASM-NEXT:   callq 0x[[#%x,qux:]]47# DISASM-EMPTY:48# DISASM-NEXT: Disassembly of section .iplt:49# DISASM-EMPTY:50# DISASM-NEXT: <.iplt>:51# DISASM-NEXT:  [[#qux]]: jmpq *{{.*}}(%rip)52# DISASM-NEXT:            pushq $053# DISASM-NEXT:            jmp 0x054# DISASM-NEXT:  [[#foo]]: jmpq *{{.*}}(%rip)55# DISASM-NEXT:            pushq $156# DISASM-NEXT:            jmp 0x057# DISASM-NEXT:  [[#bar]]: jmpq *{{.*}}(%rip)58# DISASM-NEXT:            pushq $259# DISASM-NEXT:            jmp 0x060 61#--- a.s62.globl qux, foo, bar63.type qux, @gnu_indirect_function64.type foo STT_GNU_IFUNC65.type bar STT_GNU_IFUNC66qux: ret67foo: ret68bar: ret69 70.type unused, @gnu_indirect_function71.globl unused72.weak ext73unused: mov ext@gotpcrel(%rip), %rax74 75.weak __rela_iplt_start76.weak __rela_iplt_end77 78.globl _start79_start:80 call foo81 call bar82 call qux83 84.data85  .quad __rela_iplt_start86  .quad __rela_iplt_end87  .quad .data88 89#--- b.s90.globl ext91ext:92  ret93