llvm-project
74 строки · 2.6 Кб
1# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t1.o
2# RUN: wasm-ld %t1.o -o %t -M | FileCheck --match-full-lines --strict-whitespace %s
3# RUN: wasm-ld %t1.o -o %t -print-map | FileCheck --match-full-lines --strict-whitespace %s
4# RUN: wasm-ld %t1.o -o %t -Map=%t.map
5# RUN: FileCheck --match-full-lines --strict-whitespace %s < %t.map
6
7.globaltype wasm_global, i32, immutable
8wasm_global:
9
10bar:
11.functype bar () -> (i32)
12i32.const somedata
13i32.const somezeroes
14drop
15end_function
16
17write_global:
18.functype write_global (i32) -> ()
19local.get 0
20global.set wasm_global
21end_function
22
23.globl _start
24_start:
25.functype _start () -> ()
26call bar
27call write_global
28end_function
29
30.section .data.somedata,"",@
31somedata:
32.int32 123
33.int32 bar
34.size somedata, 8
35
36.section .bss.somezeroes,"",@
37somezeroes:
38.int32 0
39.size somezeroes, 4
40
41.section .debug_info,"",@
42.int32 bar
43
44
45# CHECK: Addr Off Size Out In Symbol
46# CHECK-NEXT: - 8 e TYPE
47# CHECK-NEXT: - 16 6 FUNCTION
48# CHECK-NEXT: - 1c 7 TABLE
49# CHECK-NEXT: - 23 5 MEMORY
50# CHECK-NEXT: - 28 f GLOBAL
51# CHECK-NEXT: 0 0 0 __stack_pointer
52# CHECK-NEXT: 1 0 0 wasm_global
53# CHECK-NEXT: - 37 15 EXPORT
54# CHECK-NEXT: - 4c 9 ELEM
55# CHECK-NEXT: - 55 2d CODE
56# CHECK-NEXT: - 56 10 {{.*}}{{/|\\}}map-file.s.tmp1.o:(bar)
57# CHECK-NEXT: - 56 10 bar
58# CHECK-NEXT: - 66 b {{.*}}{{/|\\}}map-file.s.tmp1.o:(write_global)
59# CHECK-NEXT: - 66 b write_global
60# CHECK-NEXT: - 71 f {{.*}}{{/|\\}}map-file.s.tmp1.o:(_start)
61# CHECK-NEXT: - 71 f _start
62# CHECK-NEXT: - 82 11 DATA
63# CHECK-NEXT: 400 83 8 .data
64# CHECK-NEXT: 400 89 8 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.data.somedata)
65# CHECK-NEXT: 400 89 8 somedata
66# CHECK-NEXT: 408 82 4 .bss
67# CHECK-NEXT: 408 0 4 {{.*}}{{/|\\}}map-file.s.tmp1.o:(.bss.somezeroes)
68# CHECK-NEXT: 408 0 4 somezeroes
69# CHECK-NEXT: - 93 12 CUSTOM(.debug_info)
70# CHECK-NEXT: - a5 61 CUSTOM(name)
71
72# RUN: not wasm-ld %t1.o -o /dev/null -Map=/ 2>&1 \
73# RUN: | FileCheck -check-prefix=FAIL %s
74# FAIL: wasm-ld: error: cannot open map file /
75