2 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
4 ## We are intentionally building an executable here instead of a dylib / bundle
5 ## in order that the `__PAGEZERO` segment is present, which in turn means that
6 ## the image base starts at a non-zero address. This allows us to verify that
7 ## addresses in the export trie are correctly encoded as relative to the image
11 # RUN: llvm-objdump --syms --exports-trie %t | FileCheck %s --check-prefix=EXPORTS
12 # EXPORTS-LABEL: SYMBOL TABLE:
13 # EXPORTS-DAG: [[#%x, MAIN_ADDR:]] {{.*}} _main
14 # EXPORTS-DAG: [[#%x, HELLO_ADDR:]] {{.*}} _hello
15 # EXPORTS-DAG: [[#%x, HELLO_WORLD_ADDR:]] {{.*}} _hello_world
16 # EXPORTS-DAG: [[#%x, HELLO_ITS_ME_ADDR:]] {{.*}} _hello_its_me
17 # EXPORTS-DAG: [[#%x, HELLO_ITS_YOU_ADDR:]] {{.*}} _hello_its_you
18 # EXPORTS-DAG: [[#%x, HEADER_ADDR:]] g F __TEXT,__text __mh_execute_header
19 # EXPORTS-LABEL: Exports trie:
20 # EXPORTS-DAG: 0x{{0*}}[[#%X, HEADER_ADDR]] __mh_execute_header
21 # EXPORTS-DAG: 0x{{0*}}[[#%X, MAIN_ADDR]] _main
22 # EXPORTS-DAG: 0x{{0*}}[[#%X, HELLO_ADDR]] _hello
23 # EXPORTS-DAG: 0x{{0*}}[[#%X, HELLO_WORLD_ADDR]] _hello_world
24 # EXPORTS-DAG: 0x{{0*}}[[#%x, HELLO_ITS_ME_ADDR:]] _hello_its_me
25 # EXPORTS-DAG: 0x{{0*}}[[#%x, HELLO_ITS_YOU_ADDR:]] _hello_its_you
27 ## Check that we are sharing prefixes in the trie.
28 # RUN: obj2yaml %t | FileCheck %s
29 # CHECK-LABEL: ExportTrie:
32 # CHECK-DAG: Name: _mh_execute_header
33 # CHECK-DAG: Name: main
34 # CHECK-DAG: Name: hello
38 # CHECK-DAG: Name: you
43 .section __TEXT,__cstring
44 .globl _hello, _hello_world, _hello_its_me, _hello_its_you, _main
46 ## Test for when an entire symbol name is a prefix of another.
51 .asciz "Hello world!\n"
55 .asciz "Hello, it's me\n"
58 .asciz "Hello, it's you\n"