62 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o3 4## We are intentionally building an executable here instead of a dylib / bundle5## in order that the `__PAGEZERO` segment is present, which in turn means that6## the image base starts at a non-zero address. This allows us to verify that7## addresses in the export trie are correctly encoded as relative to the image8## base.9# RUN: %lld %t.o -o %t10 11# RUN: llvm-objdump --syms --exports-trie %t | FileCheck %s --check-prefix=EXPORTS12# EXPORTS-LABEL: SYMBOL TABLE:13# EXPORTS-DAG: [[#%x, MAIN_ADDR:]] {{.*}} _main14# EXPORTS-DAG: [[#%x, HELLO_ADDR:]] {{.*}} _hello15# EXPORTS-DAG: [[#%x, HELLO_WORLD_ADDR:]] {{.*}} _hello_world16# EXPORTS-DAG: [[#%x, HELLO_ITS_ME_ADDR:]] {{.*}} _hello_its_me17# EXPORTS-DAG: [[#%x, HELLO_ITS_YOU_ADDR:]] {{.*}} _hello_its_you18# EXPORTS-DAG: [[#%x, HEADER_ADDR:]] g F __TEXT,__text __mh_execute_header19# EXPORTS-LABEL: Exports trie:20# EXPORTS-DAG: 0x{{0*}}[[#%X, HEADER_ADDR]] __mh_execute_header21# EXPORTS-DAG: 0x{{0*}}[[#%X, MAIN_ADDR]] _main22# EXPORTS-DAG: 0x{{0*}}[[#%X, HELLO_ADDR]] _hello23# EXPORTS-DAG: 0x{{0*}}[[#%X, HELLO_WORLD_ADDR]] _hello_world24# EXPORTS-DAG: 0x{{0*}}[[#%x, HELLO_ITS_ME_ADDR:]] _hello_its_me25# EXPORTS-DAG: 0x{{0*}}[[#%x, HELLO_ITS_YOU_ADDR:]] _hello_its_you26 27## Check that we are sharing prefixes in the trie.28# RUN: obj2yaml %t | FileCheck %s29# CHECK-LABEL: ExportTrie:30# CHECK: Name: ''31# CHECK: Name: _32# CHECK-DAG: Name: _mh_execute_header33# CHECK-DAG: Name: main34# CHECK-DAG: Name: hello35# CHECK: Name: _36# CHECK: Name: world37# CHECK: Name: its_38# CHECK-DAG: Name: you39# CHECK-DAG: Name: me40 41 42 43.section __TEXT,__cstring44.globl _hello, _hello_world, _hello_its_me, _hello_its_you, _main45 46## Test for when an entire symbol name is a prefix of another.47_hello:48.asciz "Hello!\n"49 50_hello_world:51.asciz "Hello world!\n"52 53.data54_hello_its_me:55.asciz "Hello, it's me\n"56 57_hello_its_you:58.asciz "Hello, it's you\n"59 60_main:61 ret62