2018-01-24 11:29:47 +08:00
|
|
|
; RUN: llc -filetype=obj %p/Inputs/weak-symbol1.ll -o %t1.o
|
|
|
|
; RUN: llc -filetype=obj %p/Inputs/weak-symbol2.ll -o %t2.o
|
|
|
|
; RUN: llc -filetype=obj %s -o %t.o
|
2018-02-17 06:58:02 +08:00
|
|
|
; RUN: wasm-ld -no-gc-sections --check-signatures -o %t.wasm %t.o %t1.o %t2.o
|
2017-12-09 02:37:44 +08:00
|
|
|
; RUN: obj2yaml %t.wasm | FileCheck %s
|
|
|
|
|
2018-01-24 11:29:47 +08:00
|
|
|
target triple = "wasm32-unknown-unknown-wasm"
|
|
|
|
|
2017-12-09 02:37:44 +08:00
|
|
|
declare i32 @weakFn() local_unnamed_addr
|
2017-12-22 05:15:00 +08:00
|
|
|
@weakGlobal = external global i32
|
2017-12-09 02:37:44 +08:00
|
|
|
|
2018-02-02 08:30:03 +08:00
|
|
|
define void @_start() local_unnamed_addr {
|
2017-12-09 02:37:44 +08:00
|
|
|
entry:
|
|
|
|
%call = call i32 @weakFn()
|
2017-12-22 05:15:00 +08:00
|
|
|
%val = load i32, i32* @weakGlobal, align 4
|
2018-02-02 08:30:03 +08:00
|
|
|
ret void
|
2017-12-09 02:37:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: --- !WASM
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: FileHeader:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: Version: 0x00000001
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Sections:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Type: TYPE
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Signatures:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Index: 0
|
2018-02-02 08:30:03 +08:00
|
|
|
; CHECK-NEXT: ReturnType: NORESULT
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: ParamTypes:
|
2018-01-13 02:35:13 +08:00
|
|
|
; CHECK-NEXT: - Index: 1
|
2018-02-02 08:30:03 +08:00
|
|
|
; CHECK-NEXT: ReturnType: I32
|
2018-01-24 08:22:53 +08:00
|
|
|
; CHECK-NEXT: ParamTypes:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Type: FUNCTION
|
2018-02-02 08:30:03 +08:00
|
|
|
; CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 1, 1, 0 ]
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Type: TABLE
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Tables:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - ElemType: ANYFUNC
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Limits:
|
2017-12-14 08:34:25 +08:00
|
|
|
; CHECK-NEXT: Flags: [ HAS_MAX ]
|
2017-12-12 06:00:56 +08:00
|
|
|
; CHECK-NEXT: Initial: 0x00000002
|
|
|
|
; CHECK-NEXT: Maximum: 0x00000002
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Type: MEMORY
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Memories:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Initial: 0x00000002
|
|
|
|
; 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-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: Mutable: true
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: InitExpr:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
2017-12-22 05:15:00 +08:00
|
|
|
; 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
|
|
|
|
; CHECK-NEXT: Value: 66576
|
2018-02-07 11:04:53 +08:00
|
|
|
; CHECK-NEXT: - Index: 2
|
|
|
|
; CHECK-NEXT: Type: I32
|
|
|
|
; CHECK-NEXT: Mutable: false
|
|
|
|
; CHECK-NEXT: InitExpr:
|
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
|
|
|
; CHECK-NEXT: Value: 1032
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Type: EXPORT
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Exports:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Name: memory
|
|
|
|
; CHECK-NEXT: Kind: MEMORY
|
|
|
|
; CHECK-NEXT: Index: 0
|
|
|
|
; CHECK-NEXT: - Name: _start
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
|
|
|
; CHECK-NEXT: Index: 0
|
|
|
|
; CHECK-NEXT: - Name: weakFn
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
|
|
|
; CHECK-NEXT: Index: 1
|
|
|
|
; CHECK-NEXT: - Name: exportWeak1
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
|
|
|
; CHECK-NEXT: Index: 2
|
|
|
|
; CHECK-NEXT: - Name: exportWeak2
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
|
|
|
; CHECK-NEXT: Index: 4
|
2018-01-17 09:34:31 +08:00
|
|
|
; CHECK-NEXT: - Name: __heap_base
|
|
|
|
; CHECK-NEXT: Kind: GLOBAL
|
|
|
|
; CHECK-NEXT: Index: 1
|
2018-02-07 11:04:53 +08:00
|
|
|
; CHECK-NEXT: - Name: __data_end
|
|
|
|
; CHECK-NEXT: Kind: GLOBAL
|
|
|
|
; CHECK-NEXT: Index: 2
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Type: ELEM
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Segments:
|
|
|
|
; CHECK-NEXT: - Offset:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
|
|
|
; CHECK-NEXT: Value: 1
|
2017-12-12 06:00:56 +08:00
|
|
|
; CHECK-NEXT: Functions: [ 1 ]
|
2017-12-09 02:37:44 +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-02-02 08:30:03 +08:00
|
|
|
; CHECK-NEXT: Body: 1081808080001A0B
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 1
|
|
|
|
; CHECK-NEXT: Locals:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: Body: 41010B
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 2
|
|
|
|
; CHECK-NEXT: Locals:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: Body: 4181808080000B
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 3
|
|
|
|
; CHECK-NEXT: Locals:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: Body: 41020B
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 4
|
|
|
|
; CHECK-NEXT: Locals:
|
2017-12-12 06:00:56 +08:00
|
|
|
; CHECK-NEXT: Body: 4181808080000B
|
2018-01-13 02:35:13 +08:00
|
|
|
; CHECK-NEXT: - Index: 5
|
|
|
|
; CHECK-NEXT: Locals:
|
|
|
|
; CHECK-NEXT: Body: 0B
|
2017-12-22 05:15:00 +08:00
|
|
|
; CHECK-NEXT: - Type: DATA
|
|
|
|
; CHECK-NEXT: Segments:
|
|
|
|
; CHECK-NEXT: - SectionOffset: 7
|
|
|
|
; CHECK-NEXT: MemoryIndex: 0
|
|
|
|
; CHECK-NEXT: Offset:
|
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
|
|
|
; CHECK-NEXT: Value: 1024
|
|
|
|
; CHECK-NEXT: Content: '0100000002000000'
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Type: CUSTOM
|
|
|
|
; CHECK-NEXT: Name: name
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: FunctionNames:
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Index: 0
|
|
|
|
; CHECK-NEXT: Name: _start
|
2018-01-18 04:19:04 +08:00
|
|
|
; CHECK-NEXT: - Index: 1
|
|
|
|
; CHECK-NEXT: Name: weakFn
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Index: 2
|
|
|
|
; CHECK-NEXT: Name: exportWeak1
|
2018-01-18 04:19:04 +08:00
|
|
|
; CHECK-NEXT: - Index: 3
|
|
|
|
; CHECK-NEXT: Name: weakFn
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: - Index: 4
|
|
|
|
; CHECK-NEXT: Name: exportWeak2
|
2018-01-13 02:35:13 +08:00
|
|
|
; CHECK-NEXT: - Index: 5
|
|
|
|
; CHECK-NEXT: Name: __wasm_call_ctors
|
2017-12-09 02:37:44 +08:00
|
|
|
; CHECK-NEXT: ...
|