1; Test that internal symbols can still be GC'd when with --export-dynamic. 2; RUN: llc -filetype=obj %s -o %t.o 3; RUN: wasm-ld --export-dynamic -o %t.wasm %t.o 4; RUN: obj2yaml %t.wasm | FileCheck %s 5 6target triple = "wasm32-unknown-unknown" 7 8@foo = default global i32 1, align 4 9@bar = internal default global i32 3, align 4 10 11define internal i32 @baz() local_unnamed_addr { 12entry: 13 %0 = load i32, i32* @bar, align 4 14 ret i32 %0 15} 16 17define void @_start() local_unnamed_addr { 18entry: 19 call i32 @baz() 20 ret void 21} 22 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: TABLE 39; CHECK-NEXT: Tables: 40; CHECK-NEXT: - Index: 0 41; CHECK-NEXT: ElemType: FUNCREF 42; CHECK-NEXT: Limits: 43; CHECK-NEXT: Flags: [ HAS_MAX ] 44; CHECK-NEXT: Initial: 0x1 45; CHECK-NEXT: Maximum: 0x1 46; CHECK-NEXT: - Type: MEMORY 47; CHECK-NEXT: Memories: 48; CHECK-NEXT: - Initial: 0x2 49; CHECK-NEXT: - Type: GLOBAL 50; CHECK-NEXT: Globals: 51; CHECK-NEXT: - Index: 0 52; CHECK-NEXT: Type: I32 53; CHECK-NEXT: Mutable: true 54; CHECK-NEXT: InitExpr: 55; CHECK-NEXT: Opcode: I32_CONST 56; CHECK-NEXT: Value: 66576 57; CHECK-NEXT: - Index: 1 58; CHECK-NEXT: Type: I32 59; CHECK-NEXT: Mutable: false 60; CHECK-NEXT: InitExpr: 61; CHECK-NEXT: Opcode: I32_CONST 62; CHECK-NEXT: Value: 1024 63; CHECK-NEXT: - Type: EXPORT 64; CHECK-NEXT: Exports: 65; CHECK-NEXT: - Name: memory 66; CHECK-NEXT: Kind: MEMORY 67; CHECK-NEXT: Index: 0 68; CHECK-NEXT: - Name: _start 69; CHECK-NEXT: Kind: FUNCTION 70; CHECK-NEXT: Index: 1 71; CHECK-NEXT: - Name: foo 72; CHECK-NEXT: Kind: GLOBAL 73; CHECK-NEXT: Index: 1 74; CHECK-NEXT: - Type: CODE 75; CHECK-NEXT: Functions: 76; CHECK-NEXT: - Index: 0 77; CHECK-NEXT: Locals: 78; CHECK-NEXT: Body: 4100280284888080000B 79; CHECK-NEXT: - Index: 1 80; CHECK-NEXT: Locals: 81; CHECK-NEXT: Body: 1080808080001A0B 82; CHECK-NEXT: - Type: DATA 83; CHECK-NEXT: Segments: 84; CHECK-NEXT: - SectionOffset: 7 85; CHECK-NEXT: InitFlags: 0 86; CHECK-NEXT: Offset: 87; CHECK-NEXT: Opcode: I32_CONST 88; CHECK-NEXT: Value: 1024 89; CHECK-NEXT: Content: '0100000003000000' 90; CHECK-NEXT: - Type: CUSTOM 91; CHECK-NEXT: Name: name 92; CHECK-NEXT: FunctionNames: 93; CHECK-NEXT: - Index: 0 94; CHECK-NEXT: Name: baz 95; CHECK-NEXT: - Index: 1 96; CHECK-NEXT: Name: _start 97; CHECK-NEXT: GlobalNames: 98; CHECK-NEXT: - Index: 0 99; CHECK-NEXT: Name: __stack_pointer 100; CHECK-NEXT: ... 101