[X86][MC,LLD][NFC] Rename R_X86_64_REX2_GOTPCRELX (#116737)
[llvm-project.git] / lld / test / MachO / weak-private-extern.s
blob5c34318c4c7671ddd07432fb7de13c27494f4d3a
1 # REQUIRES: x86
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t.o
4 # RUN: %lld -dylib %t.o -o %t.dylib -lSystem
6 # RUN: llvm-objdump --macho --bind --weak-bind %t.dylib | FileCheck %s
7 # CHECK-NOT: __got
8 # CHECK-NOT: __la_symbol_ptr
10 # RUN: llvm-objdump --macho --private-header %t.dylib | \
11 # RUN: FileCheck --check-prefix=HEADERS %s
12 # HEADERS-NOT: WEAK_DEFINES
13 # HEADERS-NOT: BINDS_TO_WEAK
15 ## Check that N_WEAK_DEF isn't set in the symbol table.
16 ## This is different from ld64, which makes private extern weak symbols non-weak
17 ## for binds and relocations, but it still marks them as weak in the symbol table.
18 ## Since `nm -m` doesn't look at N_WEAK_DEF for N_PEXT symbols this is not
19 ## observable via nm, but it feels slightly more correct.
20 ## (It is observable in `llvm-objdump --syms` output.)
21 # RUN: llvm-readobj --syms %t.dylib | FileCheck --check-prefix=SYMS %s
22 # SYMS-NOT: WeakDef (0x80)
24 .globl _use
25 _use:
26 mov _weak_private_extern_gotpcrel@GOTPCREL(%rip), %rax
27 callq _weak_private_extern
28 retq
30 .private_extern _weak_private_extern
31 .globl _weak_private_extern
32 .weak_definition _weak_private_extern
33 _weak_private_extern:
34 retq
36 .private_extern _weak_private_extern_gotpcrel
37 .globl _weak_private_extern_gotpcrel
38 .weak_definition _weak_private_extern_gotpcrel
39 _weak_private_extern_gotpcrel:
40 .quad 0x1234