2018-09-28 05:06:25 +08:00
|
|
|
; Test that internal symbols can still be GC'd when with --export-dynamic.
|
2018-01-24 11:29:47 +08:00
|
|
|
; RUN: llc -filetype=obj %s -o %t.o
|
2018-09-28 05:06:25 +08:00
|
|
|
; RUN: wasm-ld --export-dynamic -o %t.wasm %t.o
|
2017-11-18 02:14:09 +08:00
|
|
|
; RUN: obj2yaml %t.wasm | FileCheck %s
|
|
|
|
|
2018-05-11 01:59:41 +08:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
2018-01-24 11:29:47 +08:00
|
|
|
|
2017-11-18 02:14:09 +08:00
|
|
|
@foo = default global i32 1, align 4
|
|
|
|
@bar = internal default global i32 3, align 4
|
|
|
|
|
|
|
|
define internal i32 @baz() local_unnamed_addr {
|
|
|
|
entry:
|
2018-01-31 09:45:47 +08:00
|
|
|
%0 = load i32, i32* @bar, align 4
|
|
|
|
ret i32 %0
|
2017-11-18 02:14:09 +08:00
|
|
|
}
|
|
|
|
|
2018-02-02 08:30:03 +08:00
|
|
|
define void @_start() local_unnamed_addr {
|
2017-11-18 02:14:09 +08:00
|
|
|
entry:
|
2018-01-31 09:45:47 +08:00
|
|
|
call i32 @baz()
|
2018-02-02 08:30:03 +08:00
|
|
|
ret void
|
2017-11-18 02:14:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: --- !WASM
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: FileHeader:
|
2020-11-18 16:59:49 +08:00
|
|
|
; CHECK-NEXT: Version: 0x1
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Sections:
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Type: TYPE
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Signatures:
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Index: 0
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: ParamTypes:
|
2019-10-19 04:27:30 +08:00
|
|
|
; CHECK-NEXT: ReturnTypes:
|
|
|
|
; CHECK-NEXT: - I32
|
2018-01-13 02:35:13 +08:00
|
|
|
; CHECK-NEXT: - Index: 1
|
2018-01-24 08:22:53 +08:00
|
|
|
; CHECK-NEXT: ParamTypes:
|
2019-10-19 04:27:30 +08:00
|
|
|
; CHECK-NEXT: ReturnTypes: []
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Type: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: FunctionTypes: [ 0, 1 ]
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Type: MEMORY
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Memories:
|
2020-11-18 16:59:49 +08:00
|
|
|
; CHECK-NEXT: - Initial: 0x2
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Type: GLOBAL
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Globals:
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 0
|
|
|
|
; CHECK-NEXT: Type: I32
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: Mutable: true
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: InitExpr:
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
|
|
|
; CHECK-NEXT: Value: 66576
|
2018-01-17 09:34:31 +08:00
|
|
|
; CHECK-NEXT: - Index: 1
|
|
|
|
; CHECK-NEXT: Type: I32
|
|
|
|
; CHECK-NEXT: Mutable: false
|
|
|
|
; CHECK-NEXT: InitExpr:
|
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
2018-03-02 22:51:36 +08:00
|
|
|
; CHECK-NEXT: Value: 1024
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Type: EXPORT
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Exports:
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Name: memory
|
|
|
|
; CHECK-NEXT: Kind: MEMORY
|
|
|
|
; CHECK-NEXT: Index: 0
|
2018-03-01 17:38:02 +08:00
|
|
|
; CHECK-NEXT: - Name: _start
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Index: 1
|
2018-03-02 22:51:36 +08:00
|
|
|
; CHECK-NEXT: - Name: foo
|
|
|
|
; CHECK-NEXT: Kind: GLOBAL
|
2019-06-01 06:51:59 +08:00
|
|
|
; CHECK-NEXT: Index: 1
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Type: CODE
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Functions:
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 0
|
|
|
|
; CHECK-NEXT: Locals:
|
2018-03-12 23:44:07 +08:00
|
|
|
; CHECK-NEXT: Body: 4100280284888080000B
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: - Index: 1
|
2018-01-13 02:35:13 +08:00
|
|
|
; CHECK-NEXT: Locals:
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Body: 1080808080001A0B
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Type: DATA
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Segments:
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - SectionOffset: 7
|
2019-02-20 06:56:19 +08:00
|
|
|
; CHECK-NEXT: InitFlags: 0
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Offset:
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
|
|
|
; CHECK-NEXT: Value: 1024
|
|
|
|
; CHECK-NEXT: Content: '0100000003000000'
|
|
|
|
; CHECK-NEXT: - Type: CUSTOM
|
|
|
|
; CHECK-NEXT: Name: name
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: FunctionNames:
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Index: 0
|
2018-03-12 23:44:07 +08:00
|
|
|
; CHECK-NEXT: Name: baz
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: - Index: 1
|
2018-03-12 23:44:07 +08:00
|
|
|
; CHECK-NEXT: Name: _start
|
2020-11-19 13:38:23 +08:00
|
|
|
; CHECK-NEXT: GlobalNames:
|
|
|
|
; CHECK-NEXT: - Index: 0
|
|
|
|
; CHECK-NEXT: Name: __stack_pointer
|
2020-12-09 13:47:19 +08:00
|
|
|
; CHECK-NEXT: DataSegmentNames:
|
|
|
|
; CHECK-NEXT: - Index: 0
|
|
|
|
; CHECK-NEXT: Name: .data
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: ...
|