File: export-trie.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (61 lines) | stat: -rw-r--r-- 1,992 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o

## We are intentionally building an executable here instead of a dylib / bundle
## in order that the `__PAGEZERO` segment is present, which in turn means that
## the image base starts at a non-zero address. This allows us to verify that
## addresses in the export trie are correctly encoded as relative to the image
## base.
# RUN: %lld %t.o -o %t

# RUN: llvm-objdump --syms --exports-trie %t | FileCheck %s --check-prefix=EXPORTS
# EXPORTS-LABEL: SYMBOL TABLE:
# EXPORTS-DAG:   [[#%x, MAIN_ADDR:]] {{.*}} _main
# EXPORTS-DAG:   [[#%x, HELLO_ADDR:]] {{.*}} _hello
# EXPORTS-DAG:   [[#%x, HELLO_WORLD_ADDR:]] {{.*}} _hello_world
# EXPORTS-DAG:   [[#%x, HELLO_ITS_ME_ADDR:]] {{.*}} _hello_its_me
# EXPORTS-DAG:   [[#%x, HELLO_ITS_YOU_ADDR:]] {{.*}} _hello_its_you
# EXPORTS-DAG:   [[#%x, HEADER_ADDR:]] g F __TEXT,__text __mh_execute_header
# EXPORTS-LABEL: Exports trie:
# EXPORTS-DAG:   0x{{0*}}[[#%X, HEADER_ADDR]] __mh_execute_header
# EXPORTS-DAG:   0x{{0*}}[[#%X, MAIN_ADDR]] _main
# EXPORTS-DAG:   0x{{0*}}[[#%X, HELLO_ADDR]] _hello
# EXPORTS-DAG:   0x{{0*}}[[#%X, HELLO_WORLD_ADDR]] _hello_world
# EXPORTS-DAG:   0x{{0*}}[[#%x, HELLO_ITS_ME_ADDR:]] _hello_its_me
# EXPORTS-DAG:   0x{{0*}}[[#%x, HELLO_ITS_YOU_ADDR:]] _hello_its_you

## Check that we are sharing prefixes in the trie.
# RUN: obj2yaml %t | FileCheck %s
# CHECK-LABEL: ExportTrie:
# CHECK: Name: ''
# CHECK: Name: _
# CHECK-DAG: Name: _mh_execute_header
# CHECK-DAG: Name: main
# CHECK-DAG: Name: hello
# CHECK: Name: _
# CHECK: Name: world
# CHECK: Name: its_
# CHECK-DAG: Name: you
# CHECK-DAG: Name: me



.section __TEXT,__cstring
.globl _hello, _hello_world, _hello_its_me, _hello_its_you, _main

## Test for when an entire symbol name is a prefix of another.
_hello:
.asciz "Hello!\n"

_hello_world:
.asciz "Hello world!\n"

.data
_hello_its_me:
.asciz "Hello, it's me\n"

_hello_its_you:
.asciz "Hello, it's you\n"

_main:
  ret