[PATCH] D41449: [WebAssembly] Add extra test for weak global symbols
Nicholas Wilson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 20 07:17:27 PST 2017
ncw updated this revision to Diff 127719.
ncw added a comment.
Oops, rebased to master than on top of my previous patches
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D41449
Files:
test/wasm/Inputs/weak-symbol1.ll
test/wasm/Inputs/weak-symbol2.ll
test/wasm/weak-symbols.ll
Index: test/wasm/weak-symbols.ll
===================================================================
--- test/wasm/weak-symbols.ll
+++ test/wasm/weak-symbols.ll
@@ -5,11 +5,13 @@
; RUN: obj2yaml %t.wasm | FileCheck %s
declare i32 @weakFn() local_unnamed_addr
+ at weakGlobal = external global i32
-define void @_start() local_unnamed_addr {
+define i32 @_start() local_unnamed_addr {
entry:
%call = call i32 @weakFn()
- ret void
+ %val = load i32, i32* @weakGlobal, align 4
+ ret i32 %val
}
; CHECK: --- !WASM
@@ -19,13 +21,10 @@
; CHECK-NEXT: - Type: TYPE
; CHECK-NEXT: Signatures:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: ReturnType: NORESULT
-; CHECK-NEXT: ParamTypes:
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 1, 1 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 0, 0, 0, 0 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: ANYFUNC
@@ -42,7 +41,7 @@
; CHECK-NEXT: Mutable: true
; CHECK-NEXT: InitExpr:
; CHECK-NEXT: Opcode: I32_CONST
-; CHECK-NEXT: Value: 66560
+; CHECK-NEXT: Value: 66576
; CHECK-NEXT: - Type: EXPORT
; CHECK-NEXT: Exports:
; CHECK-NEXT: - Name: memory
@@ -69,18 +68,26 @@
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Locals:
-; CHECK-NEXT: Body: 1081808080001A0B
+; CHECK-NEXT: Body: 1081808080001A4100280280888080000B
; CHECK-NEXT: - Locals:
; CHECK-NEXT: Body: 41010B
; CHECK-NEXT: - Locals:
; CHECK-NEXT: Body: 4181808080000B
; CHECK-NEXT: - Locals:
; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Locals:
; CHECK-NEXT: Body: 4181808080000B
+; 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'
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: linking
-; CHECK-NEXT: DataSize: 0
+; CHECK-NEXT: DataSize: 8
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
Index: test/wasm/Inputs/weak-symbol2.ll
===================================================================
--- test/wasm/Inputs/weak-symbol2.ll
+++ test/wasm/Inputs/weak-symbol2.ll
@@ -7,3 +7,5 @@
entry:
ret i32 ptrtoint (i32 ()* @weakFn to i32)
}
+
+ at weakGlobal = weak global i32 2
Index: test/wasm/Inputs/weak-symbol1.ll
===================================================================
--- test/wasm/Inputs/weak-symbol1.ll
+++ test/wasm/Inputs/weak-symbol1.ll
@@ -7,3 +7,5 @@
entry:
ret i32 ptrtoint (i32 ()* @weakFn to i32)
}
+
+ at weakGlobal = weak global i32 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41449.127719.patch
Type: text/x-patch
Size: 3288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171220/20d00a7f/attachment.bin>
More information about the llvm-commits
mailing list