[X86][MC,LLD][NFC] Rename R_X86_64_REX2_GOTPCRELX (#116737)
[llvm-project.git] / lld / test / wasm / local-symbols.ll
blob8faee647c44c88c8e210c8f9148ce2211faf3843
1 ; Test that internal symbols can still be GC'd when with --export-dynamic.
2 ; RUN: llc -mcpu=mvp -filetype=obj %s -o %t.o
3 ; RUN: wasm-ld --export-dynamic -o %t.wasm %t.o
4 ; RUN: obj2yaml %t.wasm | FileCheck %s
6 target triple = "wasm32-unknown-unknown"
8 @foo = default global i32 1, align 4
9 @bar = internal default global i32 3, align 4
11 define internal i32 @baz() local_unnamed_addr {
12 entry:
13   %0 = load i32, ptr @bar, align 4
14   ret i32 %0
17 define void @_start() local_unnamed_addr {
18 entry:
19   call i32 @baz()
20   ret void
23 ; CHECK:      --- !WASM
24 ; CHECK-NEXT: FileHeader:
25 ; CHECK-NEXT:   Version:         0x1
26 ; CHECK-NEXT: Sections:
27 ; CHECK-NEXT:   - Type:            TYPE
28 ; CHECK-NEXT:     Signatures:
29 ; CHECK-NEXT:       - Index:           0
30 ; CHECK-NEXT:         ParamTypes:
31 ; CHECK-NEXT:         ReturnTypes:
32 ; CHECK-NEXT:           - I32
33 ; CHECK-NEXT:       - Index:           1
34 ; CHECK-NEXT:         ParamTypes:
35 ; CHECK-NEXT:         ReturnTypes:     []
36 ; CHECK-NEXT:   - Type:            FUNCTION
37 ; CHECK-NEXT:     FunctionTypes:   [ 0, 1 ]
38 ; CHECK-NEXT:   - Type:            MEMORY
39 ; CHECK-NEXT:     Memories:
40 ; CHECK-NEXT:       - Minimum:         0x2
41 ; CHECK-NEXT:   - Type:            GLOBAL
42 ; CHECK-NEXT:     Globals:
43 ; CHECK-NEXT:       - Index:           0
44 ; CHECK-NEXT:         Type:            I32
45 ; CHECK-NEXT:         Mutable:         true
46 ; CHECK-NEXT:         InitExpr:
47 ; CHECK-NEXT:           Opcode:          I32_CONST
48 ; CHECK-NEXT:           Value:           66576
49 ; CHECK-NEXT:       - Index:           1
50 ; CHECK-NEXT:         Type:            I32
51 ; CHECK-NEXT:         Mutable:         false
52 ; CHECK-NEXT:         InitExpr:
53 ; CHECK-NEXT:           Opcode:          I32_CONST
54 ; CHECK-NEXT:           Value:           1024
55 ; CHECK-NEXT:   - Type:            EXPORT
56 ; CHECK-NEXT:     Exports:
57 ; CHECK-NEXT:       - Name:            memory
58 ; CHECK-NEXT:         Kind:            MEMORY
59 ; CHECK-NEXT:         Index:           0
60 ; CHECK-NEXT:       - Name:            _start
61 ; CHECK-NEXT:         Kind:            FUNCTION
62 ; CHECK-NEXT:         Index:           1
63 ; CHECK-NEXT:       - Name:            foo
64 ; CHECK-NEXT:         Kind:            GLOBAL
65 ; CHECK-NEXT:         Index:           1
66 ; CHECK-NEXT:   - Type:            CODE
67 ; CHECK-NEXT:     Functions:
68 ; CHECK-NEXT:       - Index:           0
69 ; CHECK-NEXT:         Locals:
70 ; CHECK-NEXT:         Body:            4100280284888080000B
71 ; CHECK-NEXT:       - Index:           1
72 ; CHECK-NEXT:         Locals:
73 ; CHECK-NEXT:         Body:            1080808080001A0B
74 ; CHECK-NEXT:   - Type:            DATA
75 ; CHECK-NEXT:     Segments:
76 ; CHECK-NEXT:       - SectionOffset:   7
77 ; CHECK-NEXT:         InitFlags:       0
78 ; CHECK-NEXT:         Offset:
79 ; CHECK-NEXT:           Opcode:          I32_CONST
80 ; CHECK-NEXT:           Value:           1024
81 ; CHECK-NEXT:         Content:         '0100000003000000'
82 ; CHECK-NEXT:   - Type:            CUSTOM
83 ; CHECK-NEXT:     Name:            name
84 ; CHECK-NEXT:     FunctionNames:
85 ; CHECK-NEXT:       - Index:           0
86 ; CHECK-NEXT:         Name:            baz
87 ; CHECK-NEXT:       - Index:           1
88 ; CHECK-NEXT:         Name:            _start
89 ; CHECK-NEXT:     GlobalNames:
90 ; CHECK-NEXT:       - Index:           0
91 ; CHECK-NEXT:         Name:            __stack_pointer
92 ; CHECK-NEXT:     DataSegmentNames:
93 ; CHECK-NEXT:       - Index:           0
94 ; CHECK-NEXT:         Name:            .data
95 ; CHECK-NEXT: ...