llvm-project
35 строк · 1.4 Кб
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
3
4# RUN: %lld -dylib -install_name @executable_path/libfoo.dylib \
5# RUN: %t.o -o %t.dylib
6# RUN: llvm-objdump --macho --dylib-id %t.dylib | FileCheck %s
7# CHECK: @executable_path/libfoo.dylib
8
9## If we are building a dylib, we shouldn't error out even if we are passed
10## a flag for a missing entry symbol (since dylibs don't have entry symbols).
11## Also check that we come up with the right install name if one isn't
12## specified.
13# RUN: %lld -dylib %t.o -o %t.defaultInstallName.dylib -e missing_entry
14# RUN: obj2yaml %t.defaultInstallName.dylib | FileCheck %s -DOUTPUT=%t.defaultInstallName.dylib --check-prefix=DEFAULT-INSTALL-NAME
15# DEFAULT-INSTALL-NAME: [[OUTPUT]]
16
17## Check for the absence of load commands / segments that should not be in a
18## dylib.
19# RUN: llvm-objdump --macho --all-headers %t.dylib | FileCheck %s --check-prefix=NCHECK
20# NCHECK-NOT: cmd LC_LOAD_DYLINKER
21# NCHECK-NOT: cmd LC_MAIN
22# NCHECK-NOT: segname __PAGEZERO
23
24# RUN: llvm-objdump --syms --exports-trie %t.dylib | \
25# RUN: FileCheck %s --check-prefix=EXPORTS
26# EXPORTS-LABEL: SYMBOL TABLE:
27# EXPORTS: [[#%x, HELLO_WORLD_ADDR:]] {{.*}} _hello_world
28# EXPORTS-LABEL: Exports trie:
29# EXPORTS: 0x{{0*}}[[#%X, HELLO_WORLD_ADDR]] _hello_world
30
31.section __TEXT,__cstring
32.globl _hello_world
33
34_hello_world:
35.asciz "Hello world!\n"
36