116 lines · plain
1// REQUIRES: aarch642// RUN: llvm-mc -filetype=obj -triple=aarch64 %S/Inputs/shared2.s -o %t1.o3// RUN: ld.lld %t1.o --shared --soname=t.so -o %t.so4// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o5// RUN: ld.lld --hash-style=sysv %t.so %t.o -o %tout6// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %tout | FileCheck %s --check-prefix=DISASM7// RUN: llvm-objdump -s %tout | FileCheck %s --check-prefix=GOTPLT8// RUN: llvm-readelf -S --dynamic-table -r %tout | FileCheck %s9 10// RUN: llvm-mc -filetype=obj -triple=aarch64_be %S/Inputs/shared2.s -o %t1.be.o11// RUN: ld.lld %t1.be.o --shared --soname=t.so -o %t.be.so12// RUN: llvm-mc -filetype=obj -triple=aarch64_be %s -o %t.be.o13// RUN: ld.lld --hash-style=sysv %t.be.so %t.be.o -o %t.be14// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.be | FileCheck %s --check-prefix=DISASM15// RUN: llvm-objdump -s %t.be | FileCheck %s --check-prefix=GOTPLT_BE16// RUN: llvm-readelf -S --dynamic-table -r %t.be | FileCheck %s17 18// CHECK-LABEL: Section Headers:19/// Name Type Address Off Size ES Flg Lk Inf Al20// CHECK: .iplt PROGBITS 0000000000210330 000330 000020 00 AXy 0 0 1621 22/// Check that the PLTRELSZ tag does not include the IRELATIVE relocations23// CHECK-LABEL: Dynamic section at offset 0x350 contains 15 entries:24// CHECK: 0x0000000000000008 (RELASZ) 48 (bytes)25// CHECK: 0x0000000000000002 (PLTRELSZ) 48 (bytes)26 27/// Check that the IRELATIVE relocations are after the JUMP_SLOT in the plt28// CHECK-LABEL: Relocation section '.rela.dyn' at offset 0x278 contains 2 entries:29// CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend30// CHECK-NEXT: 0000000000230468 0000000000000408 R_AARCH64_IRELATIVE 2102d831// CHECK-NEXT: 0000000000230470 0000000000000408 R_AARCH64_IRELATIVE 2102dc32// CHECK-LABEL: Relocation section '.rela.plt' at offset 0x2a8 contains 2 entries:33// CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend34// CHECK-NEXT: 0000000000230458 0000000100000402 R_AARCH64_JUMP_SLOT 0000000000000000 bar2 + 035// CHECK-NEXT: 0000000000230460 0000000200000402 R_AARCH64_JUMP_SLOT 0000000000000000 zed2 + 036 37// Check that .got.plt entries point back to PLT header38// GOTPLT: Contents of section .got.plt:39// GOTPLT-NEXT: 230440 00000000 00000000 00000000 0000000040// GOTPLT-NEXT: 230450 00000000 00000000 f0022100 0000000041// GOTPLT-NEXT: 230460 f0022100 00000000 00000000 0000000042// GOTPLT-NEXT: 230470 00000000 0000000043 44// GOTPLT_BE: Contents of section .got.plt:45// GOTPLT_BE-NEXT: 230440 00000000 00000000 00000000 0000000046// GOTPLT_BE-NEXT: 230450 00000000 00000000 00000000 002102f047// GOTPLT_BE-NEXT: 230460 00000000 002102f0 00000000 0000000048// GOTPLT_BE-NEXT: 230470 00000000 0000000049 50// Check that a PLT header is written and the ifunc entries appear last51// DISASM: Disassembly of section .text:52// DISASM-EMPTY:53// DISASM-NEXT: <foo>:54// DISASM-NEXT: 2102d8: ret55// DISASM: <bar>:56// DISASM-NEXT: 2102dc: ret57// DISASM: <_start>:58// DISASM-NEXT: 2102e0: bl 0x210330 <zed2+0x210330>59// DISASM-NEXT: 2102e4: bl 0x210340 <zed2+0x210340>60// DISASM-NEXT: 2102e8: bl 0x210310 <bar2@plt>61// DISASM-NEXT: 2102ec: bl 0x210320 <zed2@plt>62// DISASM-EMPTY:63// DISASM-NEXT: Disassembly of section .plt:64// DISASM-EMPTY:65// DISASM-NEXT: <.plt>:66// DISASM-NEXT: 2102f0: stp x16, x30, [sp, #-16]!67// DISASM-NEXT: 2102f4: adrp x16, 0x23000068// DISASM-NEXT: 2102f8: ldr x17, [x16, #1104]69// DISASM-NEXT: 2102fc: add x16, x16, #110470// DISASM-NEXT: 210300: br x1771// DISASM-NEXT: 210304: nop72// DISASM-NEXT: 210308: nop73// DISASM-NEXT: 21030c: nop74// DISASM-EMPTY:75// DISASM-NEXT: <bar2@plt>:76// DISASM-NEXT: 210310: adrp x16, 0x23000077// DISASM-NEXT: 210314: ldr x17, [x16, #1112]78// DISASM-NEXT: 210318: add x16, x16, #111279// DISASM-NEXT: 21031c: br x1780// DISASM-EMPTY:81// DISASM-NEXT: <zed2@plt>:82// DISASM-NEXT: 210320: adrp x16, 0x23000083// DISASM-NEXT: 210324: ldr x17, [x16, #1120]84// DISASM-NEXT: 210328: add x16, x16, #112085// DISASM-NEXT: 21032c: br x1786// DISASM-EMPTY:87// DISASM-NEXT: Disassembly of section .iplt:88// DISASM-EMPTY:89// DISASM-NEXT: <.iplt>:90// DISASM-NEXT: 210330: adrp x16, 0x23000091// DISASM-NEXT: 210334: ldr x17, [x16, #1128]92// DISASM-NEXT: 210338: add x16, x16, #112893// DISASM-NEXT: 21033c: br x1794// DISASM-NEXT: 210340: adrp x16, 0x23000095// DISASM-NEXT: 210344: ldr x17, [x16, #1136]96// DISASM-NEXT: 210348: add x16, x16, #113697// DISASM-NEXT: 21034c: br x1798 99.text100.type foo STT_GNU_IFUNC101.globl foo102foo:103 ret104 105.type bar STT_GNU_IFUNC106.globl bar107bar:108 ret109 110.globl _start111_start:112 bl foo113 bl bar114 bl bar2115 bl zed2116