[WebAssembly] Increase test coverage for weak aliases
authorSam Clegg <sbc@chromium.org>
Fri, 22 Dec 2017 20:35:19 +0000 (20:35 +0000)
committerSam Clegg <sbc@chromium.org>
Fri, 22 Dec 2017 20:35:19 +0000 (20:35 +0000)
LLVM-side is now fixed

Differential Revision: https://reviews.llvm.org/D41511

llvm-svn: 321385

lld/test/wasm/Inputs/weak-alias.ll
lld/test/wasm/weak-alias-overide.ll
lld/test/wasm/weak-alias.ll

index dafbfc1..b911b35 100644 (file)
@@ -20,15 +20,11 @@ entry:
 
 define i32 @call_alias_ptr() #0 {
 entry:
-; TODO(sbc): This code currently causes linker failures:
-; LLVM ERROR: symbol not found table index space: alias_fn
-; See: https://github.com/WebAssembly/tool-conventions/issues/34#
-;  %fnptr = alloca i32 ()*, align 8
-;  store i32 ()* @alias_fn, i32 ()** %fnptr, align 8
-;  %0 = load i32 ()*, i32 ()** %fnptr, align 8
-;  %call = call i32 %0()
-;  ret i32 %call
-   ret i32 1
+   %fnptr = alloca i32 ()*, align 8
+   store i32 ()* @alias_fn, i32 ()** %fnptr, align 8
+   %0 = load i32 ()*, i32 ()** %fnptr, align 8
+   %call = call i32 %0()
+   ret i32 %call
 }
 
 define i32 @call_direct_ptr() #0 {
index 1fe33b9..c2f673a 100644 (file)
@@ -36,8 +36,8 @@ entry:
 ; CHECK-NEXT:       - ElemType:        ANYFUNC
 ; CHECK-NEXT:         Limits:
 ; CHECK-NEXT:           Flags:           [ HAS_MAX ]
-; CHECK-NEXT:           Initial:         0x00000002
-; CHECK-NEXT:           Maximum:         0x00000002
+; CHECK-NEXT:           Initial:         0x00000003
+; CHECK-NEXT:           Maximum:         0x00000003
 ; CHECK-NEXT:   - Type:            MEMORY
 ; CHECK-NEXT:     Memories:
 ; CHECK-NEXT:       - Initial:         0x00000002
@@ -79,7 +79,7 @@ entry:
 ; CHECK-NEXT:       - Offset:          
 ; CHECK-NEXT:           Opcode:          I32_CONST
 ; CHECK-NEXT:           Value:           1
-; CHECK-NEXT:         Functions:       [ 2 ]
+; CHECK-NEXT:         Functions:       [ 0, 2 ]
 ; CHECK-NEXT:   - Type:            CODE
 ; CHECK-NEXT:     Functions:
 ; CHECK-NEXT:       - Locals:
@@ -93,11 +93,13 @@ entry:
 ; CHECK-NEXT:       - Locals:
 ; CHECK-NEXT:         Body:            1080808080000B
 ; CHECK-NEXT:       - Locals:          
-; CHECK-NEXT:         Body:            41010B
+; CHECK-NEXT:           - Type:            I32
+; CHECK-NEXT:             Count:           2
+; CHECK-NEXT:         Body:            23808080800041106B220024808080800020004181808080003602081080808080002101200041106A24808080800020010B
 ; CHECK-NEXT:       - Locals:          
 ; CHECK-NEXT:           - Type:            I32
 ; CHECK-NEXT:             Count:           2
-; CHECK-NEXT:         Body:            23808080800041106B220024808080800020004181808080003602081082808080002101200041106A24808080800020010B
+; CHECK-NEXT:         Body:            23808080800041106B220024808080800020004182808080003602081082808080002101200041106A24808080800020010B
 ; CHECK-NEXT:   - Type:            CUSTOM
 ; CHECK-NEXT:     Name:            linking
 ; CHECK-NEXT:     DataSize:        0
index dc29834..6a345ec 100644 (file)
@@ -30,8 +30,8 @@ entry:
 ; CHECK-NEXT:       - ElemType:        ANYFUNC
 ; CHECK-NEXT:         Limits:
 ; CHECK-NEXT:           Flags:           [ HAS_MAX ]
-; CHECK-NEXT:           Initial:         0x00000002
-; CHECK-NEXT:           Maximum:         0x00000002
+; CHECK-NEXT:           Initial:         0x00000003
+; CHECK-NEXT:           Maximum:         0x00000003
 ; CHECK-NEXT:   - Type:            MEMORY
 ; CHECK-NEXT:     Memories:
 ; CHECK-NEXT:       - Initial:         0x00000002
@@ -73,7 +73,7 @@ entry:
 ; CHECK-NEXT:       - Offset:          
 ; CHECK-NEXT:           Opcode:          I32_CONST
 ; CHECK-NEXT:           Value:           1
-; CHECK-NEXT:         Functions:       [ 1 ]
+; CHECK-NEXT:         Functions:       [ 1, 1 ]
 ; CHECK-NEXT:   - Type:            CODE
 ; CHECK-NEXT:     Functions:
 ; CHECK-NEXT:       - Locals:
@@ -85,11 +85,13 @@ entry:
 ; CHECK-NEXT:       - Locals:
 ; CHECK-NEXT:         Body:            1081808080000B
 ; CHECK-NEXT:       - Locals:          
-; CHECK-NEXT:         Body:            41010B
-; CHECK-NEXT:       - Locals:          
 ; CHECK-NEXT:           - Type:            I32
 ; CHECK-NEXT:             Count:           2
 ; CHECK-NEXT:         Body:            23808080800041106B220024808080800020004181808080003602081081808080002101200041106A24808080800020010B
+; CHECK-NEXT:       - Locals:          
+; CHECK-NEXT:           - Type:            I32
+; CHECK-NEXT:             Count:           2
+; CHECK-NEXT:         Body:            23808080800041106B220024808080800020004182808080003602081081808080002101200041106A24808080800020010B
 ; CHECK-NEXT:   - Type:            CUSTOM
 ; CHECK-NEXT:     Name:            linking
 ; CHECK-NEXT:     DataSize:        0