71 lines · plain
1# REQUIRES: aarch642# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t.o3# RUN: %lld -dylib -arch arm64 -lSystem -o %t %t.o4# RUN: llvm-objdump --syms %t > %t.objdump5# RUN: llvm-objdump --no-print-imm-hex --macho -d --section=__const %t >> %t.objdump6# RUN: FileCheck %s < %t.objdump7 8# CHECK-LABEL: SYMBOL TABLE:9# CHECK-DAG: [[#%x,PTR_1:]] l O __DATA_CONST,__const _ptr_110# CHECK-DAG: [[#%x,PTR_2:]] l O __DATA_CONST,__const _ptr_211# CHECK-DAG: [[#%x,BAR:]] g F __TEXT,__text _bar12# CHECK-DAG: [[#%x,BAZ:]] g O __DATA,__data _baz13 14# CHECK-LABEL: _foo:15## BRANCH26 relocations are 4-byte aligned, so 123 is truncated to 12016# CHECK-NEXT: bl 0x[[#BAR+120]]17## PAGE21 relocations are aligned to 4096 bytes18# CHECK-NEXT: adrp x2, [[#]] ; 0x[[#BAZ+4096-128]]19# CHECK-NEXT: ldr x2, [x2, #128]20# CHECK-NEXT: adrp x3, 8 ; 0x800021# CHECK-NEXT: ldr q0, [x3, #144]22# CHECK-NEXT: ret23 24# CHECK-LABEL: Contents of (__DATA_CONST,__const) section25# CHECK: [[#PTR_1]] {{0*}}[[#BAZ]] 00000000 00000000 0000000026# CHECK: [[#PTR_2]] {{0*}}[[#BAZ+123]] 00000000 00000000 0000000027 28.text29.globl _foo, _bar, _baz, _quux30.p2align 231_foo:32 ## Generates ARM64_RELOC_BRANCH26 and ARM64_RELOC_ADDEND33 bl _bar + 12334 ## Generates ARM64_RELOC_PAGE21 and ADDEND35 adrp x2, _baz@PAGE + 409736 ## Generates ARM64_RELOC_PAGEOFF1237 ldr x2, [x2, _baz@PAGEOFF]38 39 ## Generates ARM64_RELOC_PAGE2140 adrp x3, _quux@PAGE41 ## Generates ARM64_RELOC_PAGEOFF12 with internal slide 442 ldr q0, [x3, _quux@PAGEOFF]43 ret44 45.p2align 246_bar:47 ret48 49.data50.space 12851_baz:52.space 153 54.p2align 455_quux:56.quad 057.quad 8058 59.section __DATA_CONST,__const60## These generate ARM64_RELOC_UNSIGNED symbol relocations. llvm-mc seems to61## generate UNSIGNED section relocations only for compact unwind sections, so62## those relocations are being tested in compact-unwind.s.63_ptr_1:64 .quad _baz65 .space 866_ptr_2:67 .quad _baz + 12368 .space 869 70.subsections_via_symbols71