Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / export-trie.s
blobcfa6724c47610ea415e5779349b291239dd1c52d
1 # REQUIRES: x86
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
8 ## base.
9 # RUN: %lld %t.o -o %t
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:
30 # CHECK: Name: ''
31 # CHECK: Name: _
32 # CHECK-DAG: Name: _mh_execute_header
33 # CHECK-DAG: Name: main
34 # CHECK-DAG: Name: hello
35 # CHECK: Name: _
36 # CHECK: Name: world
37 # CHECK: Name: its_
38 # CHECK-DAG: Name: you
39 # CHECK-DAG: Name: me
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.
47 _hello:
48 .asciz "Hello!\n"
50 _hello_world:
51 .asciz "Hello world!\n"
53 .data
54 _hello_its_me:
55 .asciz "Hello, it's me\n"
57 _hello_its_you:
58 .asciz "Hello, it's you\n"
60 _main:
61 ret