xref: /llvm-project/lld/test/MachO/dso-handle.s (revision d25e572421a66270c0ee8d51c96256f2958a6f1d)
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
3
4# RUN: %lld -lSystem %t.o -o %t
5# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
6# CHECK:      leaq {{.*}} ## 0x100000000
7# CHECK-NEXT: leaq {{.*}} ## 0x100000000
8
9# RUN: %lld -dylib %t.o -o %t.dylib
10# RUN: llvm-objdump -d --no-show-raw-insn --rebase --section-headers %t.dylib | FileCheck %s --check-prefix=DYLIB-CHECK
11# DYLIB-CHECK:      leaq {{.*}} ## 0x0
12# DYLIB-CHECK-NEXT: leaq {{.*}} ## 0x0
13
14# DYLIB-LABEL: Sections:
15# DYLIB:       __data        00000008 [[#%x,DATA:]] DATA
16# DYLIB-LABEL: Rebase table:
17# DYLIB-NEXT:  segment  section  address            type
18# DYLIB-NEXT:  __DATA   __data   0x{{0*}}[[#DATA]]  pointer
19
20# RUN: llvm-objdump --syms %t.dylib | FileCheck %s --check-prefix=SYMS
21# SYMS-NOT: ___dso_handle
22
23.globl _main
24.text
25_main:
26  leaq ___dso_handle(%rip), %rdx
27  movq ___dso_handle@GOTPCREL(%rip), %rdx
28  ret
29
30.data
31.quad ___dso_handle
32