2018-01-24 11:29:47 +08:00
|
|
|
; RUN: llc -filetype=obj -o %t.o %s
|
|
|
|
; RUN: llc -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o
|
2018-09-28 05:06:25 +08:00
|
|
|
; RUN: wasm-ld --export-dynamic %t.o %t2.o -o %t.wasm
|
2017-11-18 02:14:09 +08:00
|
|
|
; RUN: obj2yaml %t.wasm | FileCheck %s
|
|
|
|
|
2017-12-21 10:30:09 +08:00
|
|
|
; Test that the strongly defined alias_fn from this file is used both here
|
|
|
|
; and in call_alias.
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2018-05-11 01:59:41 +08:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
2018-01-24 11:29:47 +08:00
|
|
|
|
2017-12-21 10:30:09 +08:00
|
|
|
define i32 @alias_fn() local_unnamed_addr #1 {
|
2017-11-18 02:14:09 +08:00
|
|
|
ret i32 1
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
|
|
define void @_start() local_unnamed_addr #1 {
|
|
|
|
entry:
|
2017-12-21 10:30:09 +08:00
|
|
|
%call = tail call i32 @alias_fn() #2
|
2017-11-18 02:14:09 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; 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
|
2019-10-19 04:27:30 +08:00
|
|
|
; CHECK-NEXT: ParamTypes: []
|
|
|
|
; CHECK-NEXT: ReturnTypes:
|
|
|
|
; CHECK-NEXT: - I32
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Index: 1
|
2019-10-19 04:27:30 +08:00
|
|
|
; CHECK-NEXT: ParamTypes: []
|
|
|
|
; 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, 0, 0, 0, 0, 0 ]
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Type: TABLE
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Tables:
|
2020-10-13 22:13:10 +08:00
|
|
|
; CHECK-NEXT: - Index: 0
|
|
|
|
; CHECK-NEXT: ElemType: FUNCREF
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Limits:
|
2017-12-14 08:34:25 +08:00
|
|
|
; CHECK-NEXT: Flags: [ HAS_MAX ]
|
2021-03-23 21:46:32 +08:00
|
|
|
; CHECK-NEXT: Minimum: 0x3
|
2020-11-18 16:59:49 +08:00
|
|
|
; CHECK-NEXT: Maximum: 0x3
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - Type: MEMORY
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Memories:
|
2021-03-23 21:46:32 +08:00
|
|
|
; CHECK-NEXT: - Minimum: 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: 66560
|
|
|
|
; 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: alias_fn
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Index: 0
|
2018-08-04 08:04:06 +08:00
|
|
|
; CHECK-NEXT: - Name: _start
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Index: 1
|
2017-12-21 10:30:09 +08:00
|
|
|
; CHECK-NEXT: - Name: direct_fn
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Index: 2
|
2017-12-21 10:30:09 +08:00
|
|
|
; CHECK-NEXT: - Name: call_direct
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Index: 3
|
2017-12-21 10:30:09 +08:00
|
|
|
; CHECK-NEXT: - Name: call_alias
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Index: 4
|
2017-12-21 10:30:09 +08:00
|
|
|
; CHECK-NEXT: - Name: call_alias_ptr
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Index: 5
|
2017-12-21 10:30:09 +08:00
|
|
|
; CHECK-NEXT: - Name: call_direct_ptr
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Index: 6
|
2017-12-21 10:30:09 +08:00
|
|
|
; CHECK-NEXT: - Type: ELEM
|
2018-01-24 08:22:53 +08:00
|
|
|
; CHECK-NEXT: Segments:
|
|
|
|
; CHECK-NEXT: - Offset:
|
2017-12-21 10:30:09 +08:00
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
|
|
|
; CHECK-NEXT: Value: 1
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Functions: [ 0, 2 ]
|
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:
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Body: 41010B
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 1
|
|
|
|
; CHECK-NEXT: Locals:
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Body: 1080808080001A0B
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 2
|
|
|
|
; CHECK-NEXT: Locals:
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Body: 41000B
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 3
|
|
|
|
; CHECK-NEXT: Locals:
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Body: 1082808080000B
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 4
|
|
|
|
; CHECK-NEXT: Locals:
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Body: 1080808080000B
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 5
|
2018-01-24 08:22:53 +08:00
|
|
|
; CHECK-NEXT: Locals:
|
2017-12-21 10:30:09 +08:00
|
|
|
; CHECK-NEXT: - Type: I32
|
|
|
|
; CHECK-NEXT: Count: 2
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081080808080002101200041106A24808080800020010B
|
|
|
|
; CHECK-NEXT: - Index: 6
|
2018-01-13 02:35:13 +08:00
|
|
|
; CHECK-NEXT: Locals:
|
2018-03-12 23:44:07 +08:00
|
|
|
; CHECK-NEXT: - Type: I32
|
|
|
|
; CHECK-NEXT: Count: 2
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Body: 23808080800041106B220024808080800020004182808080003602081082808080002101200041106A24808080800020010B
|
2017-11-18 02:14:09 +08:00
|
|
|
; 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: alias_fn
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: - Index: 1
|
2018-03-12 23:44:07 +08:00
|
|
|
; CHECK-NEXT: Name: _start
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: - Index: 2
|
2018-03-12 23:44:07 +08:00
|
|
|
; CHECK-NEXT: Name: direct_fn
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: - Index: 3
|
2018-03-12 23:44:07 +08:00
|
|
|
; CHECK-NEXT: Name: call_direct
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: - Index: 4
|
2018-03-12 23:44:07 +08:00
|
|
|
; CHECK-NEXT: Name: call_alias
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: - Index: 5
|
2018-03-12 23:44:07 +08:00
|
|
|
; CHECK-NEXT: Name: call_alias_ptr
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: - Index: 6
|
2018-03-12 23:44:07 +08:00
|
|
|
; CHECK-NEXT: Name: call_direct_ptr
|
2020-11-19 13:38:23 +08:00
|
|
|
; CHECK-NEXT: GlobalNames:
|
|
|
|
; CHECK-NEXT: - Index: 0
|
|
|
|
; CHECK-NEXT: Name: __stack_pointer
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: ...
|