Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / arm64-reloc-pointer-to-got.s
blob3d9eba0555c8a4c1a013a52caff8b5b4944847a6
1 # REQUIRES: aarch64
3 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t.o
4 # RUN: %lld -lSystem -arch arm64 -o %t %t.o
5 # RUN: llvm-objdump --macho -d --full-contents --section-headers %t | FileCheck %s
7 ## FIXME: Even though we have reserved a GOT slot for _foo due to
8 ## POINTER_TO_GOT, we should still be able to relax this GOT_LOAD reference to
9 ## it.
10 # CHECK: _main:
11 # CHECK-NEXT: adrp x8, [[#]] ;
12 # CHECK-NEXT: ldr x8, [x8] ; literal pool symbol address: _foo
13 # CHECK-NEXT: ret
15 # CHECK: Idx Name Size VMA Type
16 # CHECK: [[#]] __got 00000008 0000000100004000 DATA
17 # CHECK: [[#]] __data 00000004 0000000100008000 DATA
19 ## The relocated data should contain the difference between the addresses of
20 ## __data and __got in little-endian form.
21 # CHECK: Contents of section __DATA,__data:
22 # CHECK-NEXT: 100008000 00c0ffff
24 .globl _main, _foo
25 .p2align 2
26 _main:
27 adrp x8, _foo@GOTPAGE
28 ldr x8, [x8, _foo@GOTPAGEOFF]
29 ret
31 .p2align 2
32 _foo:
33 ret
35 .data
36 .long _foo@GOT - .