1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o 3 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 10 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-LABEL: Exports trie: 19# EXPORTS-DAG: 0x{{0*}}[[#%X, MAIN_ADDR]] _main 20# EXPORTS-DAG: 0x{{0*}}[[#%X, HELLO_ADDR]] _hello 21# EXPORTS-DAG: 0x{{0*}}[[#%X, HELLO_WORLD_ADDR]] _hello_world 22# EXPORTS-DAG: 0x{{0*}}[[#%x, HELLO_ITS_ME_ADDR:]] _hello_its_me 23# EXPORTS-DAG: 0x{{0*}}[[#%x, HELLO_ITS_YOU_ADDR:]] _hello_its_you 24 25## Check that we are sharing prefixes in the trie. 26# RUN: obj2yaml %t | FileCheck %s 27# CHECK-LABEL: ExportTrie: 28# CHECK: Name: '' 29# CHECK: Name: _ 30# CHECK: Name: main 31# CHECK: Name: hello 32# CHECK: Name: _ 33# CHECK: Name: world 34# CHECK: Name: its_ 35# CHECK: Name: you 36# CHECK: Name: me 37 38.section __TEXT,__cstring 39.globl _hello, _hello_world, _hello_its_me, _hello_its_you, _main 40 41## Test for when an entire symbol name is a prefix of another. 42_hello: 43.asciz "Hello!\n" 44 45_hello_world: 46.asciz "Hello world!\n" 47 48.data 49_hello_its_me: 50.asciz "Hello, it's me\n" 51 52_hello_its_you: 53.asciz "Hello, it's you\n" 54 55_main: 56 ret 57