3 ## This tests that we can link against these synthetic symbols even
4 ## if they are not in the symbol table.
6 # RUN: rm -rf %t; split-file %s %t
8 ## Test that in a dylib, we can link against __mh_dylib_header
9 ## (but not in other types of files)
11 # RUN: llvm-mc %t/dylib.s -triple=x86_64-apple-macos10.15 -filetype=obj -o %t/dylib.o
12 # RUN: %lld -dylib -dead_strip %t/dylib.o -o %t/dylib.out
13 # RUN: llvm-objdump -m --syms %t/dylib.out | FileCheck %s --check-prefix DYLIB
15 # RUN: not %lld -o /dev/null %t/dylib.o 2>&1 | FileCheck %s --check-prefix ERR-DYLIB
17 # DYLIB: SYMBOL TABLE:
18 # DYLIB-NEXT: {{[0-9a-f]+}} g F __TEXT,__text _main
20 # ERR-DYLIB: error: undefined symbol: __mh_dylib_header
22 ## Test that in an executable, we can link against __mh_execute_header
23 # RUN: llvm-mc %t/main.s -triple=x86_64-apple-macos10.15 -filetype=obj -o %t/exec.o
24 # RUN: %lld -dead_strip -lSystem %t/exec.o -o %t/exec.out
26 ## But it would be an error trying to reference __mh_execute_header in a dylib
27 # RUN: not %lld -o /dev/null -dylib %t/exec.o 2>&1 | FileCheck %s --check-prefix ERR-EXEC
29 # ERR-EXEC: error: undefined symbol: __mh_execute_header
35 mov __mh_execute_header@GOTPCREL
(%rip
), %rax
37 .subsections_via_symbols
43 mov __mh_dylib_header@GOTPCREL
(%rip
), %rax
45 .subsections_via_symbols