72 lines · plain
1// REQUIRES: x862// RUN: llvm-mc -filetype=obj -triple=i686-pc-freebsd %S/Inputs/shared2-x86-64.s -o %t1.o3// RUN: ld.lld %t1.o --shared --soname=t.so -o %t.so4// RUN: llvm-mc -filetype=obj -triple=i686-pc-freebsd %s -o %t.o5// RUN: ld.lld -z ifunc-noplt -z notext --hash-style=sysv %t.so %t.o -o %tout6// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %tout | FileCheck %s --check-prefix=DISASM7// RUN: llvm-readobj -r --dynamic-table %tout | FileCheck %s8 9// Check that we emitted relocations for the ifunc calls10// CHECK: Relocations [11// CHECK-NEXT: Section (4) .rel.dyn {12// CHECK-NEXT: 0x4011EF R_386_PLT32 foo13// CHECK-NEXT: 0x4011F4 R_386_PLT32 bar14// CHECK-NEXT: }15// CHECK-NEXT: Section (5) .rel.plt {16// CHECK-NEXT: 0x4032D4 R_386_JUMP_SLOT bar217// CHECK-NEXT: 0x4032D8 R_386_JUMP_SLOT zed218// CHECK-NEXT: }19 20// Check that ifunc call sites still require relocation21// DISASM: Disassembly of section .text:22// DISASM-EMPTY:23// DISASM-NEXT: 004011ec <foo>:24// DISASM-NEXT: retl25// DISASM-EMPTY:26// DISASM-NEXT: 004011ed <bar>:27// DISASM-NEXT: retl28// DISASM-EMPTY:29// DISASM-NEXT: 004011ee <_start>:30// DISASM-NEXT: calll 0x4011ef <_start+0x1>31// DISASM-NEXT: calll 0x4011f4 <_start+0x6>32// DISASM-NEXT: calll 0x401220 <bar2@plt>33// DISASM-NEXT: calll 0x401230 <zed2@plt>34// DISASM-EMPTY:35// DISASM-NEXT: Disassembly of section .plt:36// DISASM-EMPTY:37// DISASM-NEXT: 00401210 <.plt>:38// DISASM-NEXT: pushl 0x4032cc39// DISASM-NEXT: jmpl *0x4032d040// DISASM-NEXT: nop41// DISASM-NEXT: nop42// DISASM-NEXT: nop43// DISASM-NEXT: nop44// DISASM-EMPTY:45// DISASM-NEXT: 00401220 <bar2@plt>:46// DISASM-NEXT: jmpl *0x4032d447// DISASM-NEXT: pushl $0x048// DISASM-NEXT: jmp 0x401210 <.plt>49// DISASM-EMPTY:50// DISASM-NEXT: 00401230 <zed2@plt>:51// DISASM-NEXT: jmpl *0x4032d852// DISASM-NEXT: pushl $0x853// DISASM-NEXT: jmp 0x401210 <.plt>54 55.text56.type foo STT_GNU_IFUNC57.globl foo58foo:59 ret60 61.type bar STT_GNU_IFUNC62.globl bar63bar:64 ret65 66.globl _start67_start:68 call foo@plt69 call bar@plt70 call bar2@plt71 call zed2@plt72