83 lines · plain
1// REQUIRES: x862 3/// For non-preemptable ifunc, place ifunc PLT entries after regular PLT entries.4 5// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o6// RUN: ld.lld --shared -o %t.so %t.o7// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.so | FileCheck %s --check-prefix=DISASM8// RUN: llvm-readobj -r %t.so | FileCheck %s9 10// Check that an IRELATIVE relocation is used for a non-preemptible ifunc11// handler and a JUMP_SLOT is used for a preemptible ifunc12// DISASM: Disassembly of section .text:13// DISASM-EMPTY:14// DISASM-NEXT: <fct>:15// DISASM-NEXT: 1308: retq16// DISASM: <fct2>:17// DISASM-NEXT: 1309: retq18// DISASM: <f1>:19// DISASM-NEXT: 130a: callq 0x135020// DISASM-NEXT: 130f: callq 0x133021// DISASM-NEXT: 1314: callq 0x134022// DISASM-NEXT: 1319: retq23// DISASM: <f2>:24// DISASM-NEXT: 131a: retq25// DISASM-EMPTY:26// DISASM-NEXT: Disassembly of section .plt:27// DISASM-EMPTY:28// DISASM-NEXT: <.plt>:29// DISASM-NEXT: 1320: pushq 8482(%rip)30// DISASM-NEXT: 1326: jmpq *8484(%rip)31// DISASM-NEXT: 132c: nopl (%rax)32// DISASM-EMPTY:33// DISASM-NEXT: <fct2@plt>:34// DISASM-NEXT: 1330: jmpq *8482(%rip)35// DISASM-NEXT: 1336: pushq $036// DISASM-NEXT: 133b: jmp 0x1320 <.plt>37// DISASM-EMPTY:38// DISASM-NEXT: <f2@plt>:39// DISASM-NEXT: 1340: jmpq *8474(%rip)40// DISASM-NEXT: 1346: pushq $141// DISASM-NEXT: 134b: jmp 0x1320 <.plt>42// DISASM: Disassembly of section .iplt:43// DISASM-EMPTY:44// DISASM: <.iplt>:45// DISASM-NEXT: 1350: jmpq *8466(%rip)46// DISASM-NEXT: 1356: pushq $047// DISASM-NEXT: 135b: jmp 0x1320 <.plt>48 49// CHECK: Relocations [50// CHECK-NEXT: Section (5) .rela.dyn {51// CHECK-NEXT: 0x3468 R_X86_64_IRELATIVE - 0x130852// CHECK-NEXT: }53// CHECK-NEXT: Section (6) .rela.plt {54// CHECK-NEXT: 0x3458 R_X86_64_JUMP_SLOT fct2 0x055// CHECK-NEXT: 0x3460 R_X86_64_JUMP_SLOT f2 0x056// CHECK-NEXT: }57 58 // Hidden expect IRELATIVE59 .globl fct60 .hidden fct61 .type fct, STT_GNU_IFUNC62fct:63 ret64 65 // Not hidden expect JUMP_SLOT66 .globl fct267 .type fct2, STT_GNU_IFUNC68fct2:69 ret70 71 .globl f172 .type f1, @function73f1:74 call fct75 call fct276 call f2@PLT77 ret78 79 .globl f280 .type f2, @function81f2:82 ret83