100 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabihf %S/Inputs/arm-shared.s -o %t1.o3// RUN: ld.lld %t1.o --shared -soname=t.so -o %t.so4// RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabihf %s -o %t.o5// RUN: ld.lld %t.so %t.o -o %tout6// RUN: llvm-objdump --no-print-imm-hex --triple=armv7a-linux-gnueabihf -d --no-show-raw-insn %tout | FileCheck %s --check-prefix=DISASM7// RUN: llvm-objdump -s %tout | FileCheck %s --check-prefix=GOTPLT8// RUN: llvm-readobj -r --dynamic-table %tout | FileCheck %s9 10// Check that the IRELATIVE relocations are last in the .got11// CHECK: Relocations [12// CHECK-NEXT: Section (5) .rel.dyn {13// CHECK-NEXT: 0x302E0 R_ARM_GLOB_DAT bar214// CHECK-NEXT: 0x302E4 R_ARM_GLOB_DAT zed215// CHECK-NEXT: 0x302E8 R_ARM_IRELATIVE -16// CHECK-NEXT: 0x302EC R_ARM_IRELATIVE -17// CHECK-NEXT: }18// CHECK-NEXT: Section (6) .rel.plt {19// CHECK-NEXT: 0x402FC R_ARM_JUMP_SLOT bar220// CHECK-NEXT: 0x40300 R_ARM_JUMP_SLOT zed221// CHECK-NEXT: }22// CHECK-NEXT: ]23 24// Check that the GOT entries refer back to the ifunc resolver25// GOTPLT: Contents of section .got:26// GOTPLT-NEXT: 302e0 00000000 00000000 dc010200 e001020027// GOTPLT: Contents of section .got.plt:28// GOTPLT-NEXT: 402f0 00000000 00000000 00000000 0002020029// GOTPLT-NEXT: 40300 0002020030 31// DISASM: Disassembly of section .text:32// DISASM-EMPTY:33// DISASM-NEXT: <foo>:34// DISASM-NEXT: 201dc: bx lr35// DISASM: <bar>:36// DISASM-NEXT: 201e0: bx lr37// DISASM: <_start>:38// DISASM-NEXT: 201e4: bl 0x2024039// DISASM-NEXT: 201e8: bl 0x2025040// DISASM-NEXT: 201ec: 00 00 00 00 .word 0x0000000041// DISASM-NEXT: 201f0: 04 00 00 00 .word 0x0000000442// DISASM: 201f4: bl 0x2022043// DISASM-NEXT: 201f8: bl 0x2023044// DISASM-EMPTY:45// DISASM-NEXT: Disassembly of section .plt:46// DISASM-EMPTY:47// DISASM-NEXT: <.plt>:48// DISASM-NEXT: 20200: str lr, [sp, #-4]!49// DISASM-NEXT: 20204: add lr, pc, #0, #1250// DISASM-NEXT: 20208: add lr, lr, #3251// DISASM-NEXT: 2020c: ldr pc, [lr, #236]!52// DISASM-NEXT: 20210: d4 d4 d4 d4 .word 0xd4d4d4d453// DISASM-NEXT: 20214: d4 d4 d4 d4 .word 0xd4d4d4d454// DISASM-NEXT: 20218: d4 d4 d4 d4 .word 0xd4d4d4d455// DISASM-NEXT: 2021c: d4 d4 d4 d4 .word 0xd4d4d4d456// DISASM-EMPTY:57// DISASM-NEXT: <bar2@plt>:58// DISASM-NEXT: 20220: add r12, pc, #0, #1259// DISASM-NEXT: 20224: add r12, r12, #3260// DISASM-NEXT: 20228: ldr pc, [r12, #212]!61// DISASM-NEXT: 2022c: d4 d4 d4 d4 .word 0xd4d4d4d462// DISASM-EMPTY:63// DISASM-NEXT: <zed2@plt>:64// DISASM-NEXT: 20230: add r12, pc, #0, #1265// DISASM-NEXT: 20234: add r12, r12, #3266// DISASM-NEXT: 20238: ldr pc, [r12, #200]!67// DISASM-NEXT: 2023c: d4 d4 d4 d4 .word 0xd4d4d4d468// DISASM: <.iplt>:69// DISASM-NEXT: 20240: add r12, pc, #0, #1270// DISASM-NEXT: 20244: add r12, r12, #1671// DISASM-NEXT: 20248: ldr pc, [r12, #160]!72// DISASM-NEXT: 2024c: d4 d4 d4 d4 .word 0xd4d4d4d473// DISASM-NEXT: 20250: add r12, pc, #0, #1274// DISASM-NEXT: 20254: add r12, r12, #1675// DISASM-NEXT: 20258: ldr pc, [r12, #148]!76// DISASM-NEXT: 2025c: d4 d4 d4 d4 .word 0xd4d4d4d477 78.syntax unified79.text80.type foo STT_GNU_IFUNC81.globl foo82foo:83 bx lr84 85.type bar STT_GNU_IFUNC86.globl bar87bar:88 bx lr89 90.globl _start91_start:92 bl foo93 bl bar94 // Create entries in the .got and .rel.dyn so that we don't just have95 // IRELATIVE96 .word bar2(got)97 .word zed2(got)98 bl bar299 bl zed2100