[lld] r327286 - [WebAssembly] Reorder synthetic functions to come first
Nicholas Wilson via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 12 08:44:07 PDT 2018
Author: ncw
Date: Mon Mar 12 08:44:07 2018
New Revision: 327286
URL: http://llvm.org/viewvc/llvm-project?rev=327286&view=rev
Log:
[WebAssembly] Reorder synthetic functions to come first
This matches the existing ordering that's been there for globals
for a while (__stack_pointer coming first).
Differential Revision: https://reviews.llvm.org/D44333
Modified:
lld/trunk/test/wasm/alias.ll
lld/trunk/test/wasm/call-indirect.ll
lld/trunk/test/wasm/comdats.ll
lld/trunk/test/wasm/entry.ll
lld/trunk/test/wasm/export.ll
lld/trunk/test/wasm/function-imports-first.ll
lld/trunk/test/wasm/function-imports.ll
lld/trunk/test/wasm/gc-sections.ll
lld/trunk/test/wasm/init-fini.ll
lld/trunk/test/wasm/load-undefined.test
lld/trunk/test/wasm/local-symbols.ll
lld/trunk/test/wasm/locals-duplicate.test
lld/trunk/test/wasm/undefined-weak-call.ll
lld/trunk/test/wasm/visibility-hidden.ll
lld/trunk/test/wasm/weak-alias-overide.ll
lld/trunk/test/wasm/weak-alias.ll
lld/trunk/test/wasm/weak-symbols.ll
lld/trunk/test/wasm/weak-undefined.ll
lld/trunk/wasm/Writer.cpp
Modified: lld/trunk/test/wasm/alias.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/alias.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/alias.ll (original)
+++ lld/trunk/test/wasm/alias.ll Mon Mar 12 08:44:07 2018
@@ -66,10 +66,10 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 0
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: start_alias
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 0
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
@@ -82,7 +82,7 @@ entry:
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: _start
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: __wasm_call_ctors
+; CHECK-NEXT: - Index: 1
+; CHECK-NEXT: Name: _start
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/call-indirect.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/call-indirect.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/call-indirect.ll (original)
+++ lld/trunk/test/wasm/call-indirect.ll Mon Mar 12 08:44:07 2018
@@ -57,7 +57,7 @@ define void @call_ptr(i64 (i64)* %arg) {
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - I32
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 3, 1, 3, 4, 3 ]
+; CHECK-NEXT: FunctionTypes: [ 3, 0, 3, 1, 3, 4 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: ANYFUNC
@@ -107,50 +107,50 @@ define void @call_ptr(i64 (i64)* %arg) {
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 4
; CHECK-NEXT: - Name: bar
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 0
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: call_bar_indirect
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: foo
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: indirect_func
; CHECK-NEXT: Kind: GLOBAL
; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: call_ptr
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 4
+; CHECK-NEXT: Index: 5
; CHECK-NEXT: - Type: ELEM
; CHECK-NEXT: Segments:
; CHECK-NEXT: - Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1
-; CHECK-NEXT: Functions: [ 0, 2 ]
+; CHECK-NEXT: Functions: [ 1, 3 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 42010B
+; CHECK-NEXT: Body: 0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
+; CHECK-NEXT: Body: 42010B
+; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: Locals:
; CHECK-NEXT: - Type: I32
; CHECK-NEXT: Count: 1
; CHECK-NEXT: Body: 4100280284888080002100410028028088808000118080808000001A2000118180808000001A0B
-; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 410028028888808000118180808000001A0B
+; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 42012000118280808000001A0B
+; CHECK-NEXT: Body: 410028028888808000118180808000001A0B
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 42012000118280808000001A0B
; CHECK-NEXT: - Type: DATA
; CHECK-NEXT: Segments:
; CHECK-NEXT: - SectionOffset: 7
@@ -163,10 +163,15 @@ define void @call_ptr(i64 (i64)* %arg) {
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: bar
+; CHECK-NEXT: Name: __wasm_call_ctors
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Name: call_bar_indirect
+; CHECK-NEXT: Name: bar
; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Name: foo
+; CHECK-NEXT: Name: call_bar_indirect
; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: Name: foo
+; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Name: _start
+; CHECK-NEXT: - Index: 5
+; CHECK-NEXT: Name: call_ptr
+; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/comdats.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/comdats.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/comdats.ll (original)
+++ lld/trunk/test/wasm/comdats.ll Mon Mar 12 08:44:07 2018
@@ -53,42 +53,42 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 0
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: inlineFn
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: constantData
; CHECK-NEXT: Kind: GLOBAL
; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: callInline1
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: callInline2
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 4
; CHECK-NEXT: - Type: ELEM
; CHECK-NEXT: Segments:
; CHECK-NEXT: - Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1
-; CHECK-NEXT: Functions: [ 1 ]
+; CHECK-NEXT: Functions: [ 2 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1081808080001A0B
+; CHECK-NEXT: Body: 0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4180888080000B
+; CHECK-NEXT: Body: 1082808080001A0B
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4181808080000B
+; CHECK-NEXT: Body: 4180888080000B
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4181808080000B
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 4181808080000B
; CHECK-NEXT: - Type: DATA
; CHECK-NEXT: Segments:
; CHECK-NEXT: - SectionOffset: 7
Modified: lld/trunk/test/wasm/entry.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/entry.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/entry.ll (original)
+++ lld/trunk/test/wasm/entry.ll Mon Mar 12 08:44:07 2018
@@ -25,7 +25,7 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: entry
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 0
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Type:
; The __wasm_call_ctors is somewhat special. Make sure we can use it
Modified: lld/trunk/test/wasm/export.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/export.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/export.ll (original)
+++ lld/trunk/test/wasm/export.ll Mon Mar 12 08:44:07 2018
@@ -30,8 +30,8 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: hidden_function
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 0
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Type: CODE
Modified: lld/trunk/test/wasm/function-imports-first.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/function-imports-first.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/function-imports-first.ll (original)
+++ lld/trunk/test/wasm/function-imports-first.ll Mon Mar 12 08:44:07 2018
@@ -24,25 +24,25 @@ declare i32 @ret32(float) local_unnamed_
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - F32
; CHECK: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 1, 0 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 0, 1 ]
; CHECK: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 43000000001081808080001A0B
+; CHECK-NEXT: Body: 0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41000B
+; CHECK-NEXT: Body: 43000000001082808080001A0B
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 41000B
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: _start
+; CHECK-NEXT: Name: __wasm_call_ctors
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Name: ret32
+; CHECK-NEXT: Name: _start
; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Name: __wasm_call_ctors
+; CHECK-NEXT: Name: ret32
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/function-imports.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/function-imports.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/function-imports.ll (original)
+++ lld/trunk/test/wasm/function-imports.ll Mon Mar 12 08:44:07 2018
@@ -18,14 +18,14 @@ declare i32 @ret32(float) local_unnamed_
; CHECK: - Type: TYPE
; CHECK-NEXT: Signatures:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: ReturnType: I32
+; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
-; CHECK-NEXT: - F32
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: ReturnType: NORESULT
+; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
+; CHECK-NEXT: - F32
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 1, 1 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 1, 0 ]
; CHECK: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK: - Index: 0
@@ -34,9 +34,9 @@ declare i32 @ret32(float) local_unnamed_
; CHECK: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: ret32
+; CHECK-NEXT: Name: __wasm_call_ctors
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Name: _start
+; CHECK-NEXT: Name: ret32
; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Name: __wasm_call_ctors
+; CHECK-NEXT: Name: _start
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/gc-sections.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/gc-sections.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/gc-sections.ll (original)
+++ lld/trunk/test/wasm/gc-sections.ll Mon Mar 12 08:44:07 2018
@@ -31,10 +31,10 @@ entry:
; CHECK: - Type: TYPE
; CHECK-NEXT: Signatures:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: ReturnType: I32
+; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: ReturnType: NORESULT
+; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
@@ -48,13 +48,13 @@ entry:
; CHECK-NEXT: Content: '02000000'
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
-; CHECK-NEXT: FunctionNames:
+; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: used_function
+; CHECK-NEXT: Name: __wasm_call_ctors
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Name: _start
+; CHECK-NEXT: Name: used_function
; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Name: __wasm_call_ctors
+; CHECK-NEXT: Name: _start
; CHECK-NEXT: ...
; RUN: wasm-ld -print-gc-sections --no-gc-sections -o %t1.no-gc.wasm %t.o
@@ -63,13 +63,13 @@ entry:
; NO-GC: - Type: TYPE
; NO-GC-NEXT: Signatures:
; NO-GC-NEXT: - Index: 0
-; NO-GC-NEXT: ReturnType: I64
-; NO-GC-NEXT: ParamTypes:
+; NO-GC-NEXT: ReturnType: NORESULT
+; NO-GC-NEXT: ParamTypes:
; NO-GC-NEXT: - Index: 1
-; NO-GC-NEXT: ReturnType: I32
+; NO-GC-NEXT: ReturnType: I64
; NO-GC-NEXT: ParamTypes:
; NO-GC-NEXT: - Index: 2
-; NO-GC-NEXT: ReturnType: NORESULT
+; NO-GC-NEXT: ReturnType: I32
; NO-GC-NEXT: ParamTypes:
; NO-GC-NEXT: - Type: FUNCTION
@@ -83,15 +83,15 @@ entry:
; NO-GC-NEXT: Content: '010000000000000002000000'
; NO-GC-NEXT: - Type: CUSTOM
; NO-GC-NEXT: Name: name
-; NO-GC-NEXT: FunctionNames:
+; NO-GC-NEXT: FunctionNames:
; NO-GC-NEXT: - Index: 0
-; NO-GC-NEXT: Name: unused_function
+; NO-GC-NEXT: Name: __wasm_call_ctors
; NO-GC-NEXT: - Index: 1
-; NO-GC-NEXT: Name: used_function
+; NO-GC-NEXT: Name: unused_function
; NO-GC-NEXT: - Index: 2
-; NO-GC-NEXT: Name: _start
+; NO-GC-NEXT: Name: used_function
; NO-GC-NEXT: - Index: 3
-; NO-GC-NEXT: Name: __wasm_call_ctors
+; NO-GC-NEXT: Name: _start
; NO-GC-NEXT: ...
; RUN: not wasm-ld --gc-sections --relocatable -o %t1.no-gc.wasm %t.o 2>&1 | FileCheck %s -check-prefix=CHECK-ERROR
Modified: lld/trunk/test/wasm/init-fini.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/init-fini.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/init-fini.ll (original)
+++ lld/trunk/test/wasm/init-fini.ll Mon Mar 12 08:44:07 2018
@@ -52,50 +52,56 @@ entry:
; CHECK-NEXT: - Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1
-; CHECK-NEXT: Functions: [ 6, 8, 12, 14, 16 ]
-
-; CHECK: Body: 100010011007100A100D100A100F10001009100A10110B
+; CHECK-NEXT: Functions: [ 7, 9, 13, 15, 17 ]
+; CHECK-NEXT: - Type: CODE
+; CHECK-NEXT: Functions:
+; CHECK-NEXT: - Index: 0
+; CHECK-NEXT: Locals:
+; CHECK-NEXT: Body: 100110021008100B100E100B10101001100A100B10120B
+; CHECK: - Index: 18
+; CHECK-NEXT: Locals:
+; CHECK-NEXT: Body: 024041858080800041004180888080001085808080000D000F0B00000B
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: func1
+; CHECK-NEXT: Name: __wasm_call_ctors
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Name: func2
+; CHECK-NEXT: Name: func1
; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Name: func3
+; CHECK-NEXT: Name: func2
; CHECK-NEXT: - Index: 3
-; CHECK-NEXT: Name: func4
+; CHECK-NEXT: Name: func3
; CHECK-NEXT: - Index: 4
-; CHECK-NEXT: Name: __cxa_atexit
+; CHECK-NEXT: Name: func4
; CHECK-NEXT: - Index: 5
-; CHECK-NEXT: Name: _start
+; CHECK-NEXT: Name: __cxa_atexit
; CHECK-NEXT: - Index: 6
-; CHECK-NEXT: Name: .Lcall_dtors.101
+; CHECK-NEXT: Name: _start
; CHECK-NEXT: - Index: 7
-; CHECK-NEXT: Name: .Lregister_call_dtors.101
+; CHECK-NEXT: Name: .Lcall_dtors.101
; CHECK-NEXT: - Index: 8
-; CHECK-NEXT: Name: .Lcall_dtors.1001
+; CHECK-NEXT: Name: .Lregister_call_dtors.101
; CHECK-NEXT: - Index: 9
-; CHECK-NEXT: Name: .Lregister_call_dtors.1001
+; CHECK-NEXT: Name: .Lcall_dtors.1001
; CHECK-NEXT: - Index: 10
-; CHECK-NEXT: Name: myctor
+; CHECK-NEXT: Name: .Lregister_call_dtors.1001
; CHECK-NEXT: - Index: 11
-; CHECK-NEXT: Name: mydtor
+; CHECK-NEXT: Name: myctor
; CHECK-NEXT: - Index: 12
-; CHECK-NEXT: Name: .Lcall_dtors.101
+; CHECK-NEXT: Name: mydtor
; CHECK-NEXT: - Index: 13
-; CHECK-NEXT: Name: .Lregister_call_dtors.101
+; CHECK-NEXT: Name: .Lcall_dtors.101
; CHECK-NEXT: - Index: 14
-; CHECK-NEXT: Name: .Lcall_dtors.202
+; CHECK-NEXT: Name: .Lregister_call_dtors.101
; CHECK-NEXT: - Index: 15
-; CHECK-NEXT: Name: .Lregister_call_dtors.202
+; CHECK-NEXT: Name: .Lcall_dtors.202
; CHECK-NEXT: - Index: 16
-; CHECK-NEXT: Name: .Lcall_dtors.2002
+; CHECK-NEXT: Name: .Lregister_call_dtors.202
; CHECK-NEXT: - Index: 17
-; CHECK-NEXT: Name: .Lregister_call_dtors.2002
+; CHECK-NEXT: Name: .Lcall_dtors.2002
; CHECK-NEXT: - Index: 18
-; CHECK-NEXT: Name: __wasm_call_ctors
+; CHECK-NEXT: Name: .Lregister_call_dtors.2002
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/load-undefined.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/load-undefined.test?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/load-undefined.test (original)
+++ lld/trunk/test/wasm/load-undefined.test Mon Mar 12 08:44:07 2018
@@ -21,13 +21,13 @@
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 0
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: ret32
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: ret64
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Type:
Modified: lld/trunk/test/wasm/local-symbols.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/local-symbols.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/local-symbols.ll (original)
+++ lld/trunk/test/wasm/local-symbols.ll Mon Mar 12 08:44:07 2018
@@ -26,13 +26,13 @@ entry:
; CHECK-NEXT: - Type: TYPE
; CHECK-NEXT: Signatures:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: ReturnType: I32
+; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: ReturnType: NORESULT
+; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 1, 1 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 1, 0 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: ANYFUNC
@@ -82,7 +82,7 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: foo
; CHECK-NEXT: Kind: GLOBAL
; CHECK-NEXT: Index: 3
@@ -90,13 +90,13 @@ entry:
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4100280284888080000B
+; CHECK-NEXT: Body: 0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1080808080001A0B
+; CHECK-NEXT: Body: 4100280284888080000B
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 1081808080001A0B
; CHECK-NEXT: - Type: DATA
; CHECK-NEXT: Segments:
; CHECK-NEXT: - SectionOffset: 7
@@ -109,9 +109,9 @@ entry:
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: baz
+; CHECK-NEXT: Name: __wasm_call_ctors
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Name: _start
+; CHECK-NEXT: Name: baz
; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Name: __wasm_call_ctors
+; CHECK-NEXT: Name: _start
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/locals-duplicate.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/locals-duplicate.test?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/locals-duplicate.test (original)
+++ lld/trunk/test/wasm/locals-duplicate.test Mon Mar 12 08:44:07 2018
@@ -10,14 +10,14 @@
; CHECK-NEXT: - Type: TYPE
; CHECK-NEXT: Signatures:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: ReturnType: I32
+; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: ReturnType: NORESULT
+; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-; CHECK-NEXT: 0, 0, 1 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+; CHECK-NEXT: 1, 1, 1 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: ANYFUNC
@@ -73,63 +73,63 @@
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: colliding_func2
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: get_global1A
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 4
; CHECK-NEXT: - Name: get_global2A
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 4
+; CHECK-NEXT: Index: 5
; CHECK-NEXT: - Name: colliding_global2
; CHECK-NEXT: Kind: GLOBAL
; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: get_global3A
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 5
+; CHECK-NEXT: Index: 6
; CHECK-NEXT: - Name: get_func1A
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 6
+; CHECK-NEXT: Index: 7
; CHECK-NEXT: - Name: get_func2A
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 7
+; CHECK-NEXT: Index: 8
; CHECK-NEXT: - Name: get_func3A
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 8
+; CHECK-NEXT: Index: 9
; CHECK-NEXT: - Name: colliding_func1
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 9
+; CHECK-NEXT: Index: 10
; CHECK-NEXT: - Name: get_global1B
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 12
+; CHECK-NEXT: Index: 13
; CHECK-NEXT: - Name: colliding_global1
; CHECK-NEXT: Kind: GLOBAL
; CHECK-NEXT: Index: 4
; CHECK-NEXT: - Name: get_global2B
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 13
+; CHECK-NEXT: Index: 14
; CHECK-NEXT: - Name: get_global3B
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 14
+; CHECK-NEXT: Index: 15
; CHECK-NEXT: - Name: get_func1B
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 15
+; CHECK-NEXT: Index: 16
; CHECK-NEXT: - Name: get_func2B
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 16
+; CHECK-NEXT: Index: 17
; CHECK-NEXT: - Name: get_func3B
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 17
+; CHECK-NEXT: Index: 18
; CHECK-NEXT: - Type: ELEM
; CHECK-NEXT: Segments:
; CHECK-NEXT: - Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1
-; CHECK-NEXT: Functions: [ 0, 1, 2, 9, 10, 11 ]
+; CHECK-NEXT: Functions: [ 1, 2, 3, 10, 11, 12 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41020B
+; CHECK-NEXT: Body: 0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 41020B
@@ -138,25 +138,25 @@
; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4180888080000B
+; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4184888080000B
+; CHECK-NEXT: Body: 4180888080000B
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4188888080000B
+; CHECK-NEXT: Body: 4184888080000B
; CHECK-NEXT: - Index: 6
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4181808080000B
+; CHECK-NEXT: Body: 4188888080000B
; CHECK-NEXT: - Index: 7
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4182808080000B
+; CHECK-NEXT: Body: 4181808080000B
; CHECK-NEXT: - Index: 8
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4183808080000B
+; CHECK-NEXT: Body: 4182808080000B
; CHECK-NEXT: - Index: 9
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41020B
+; CHECK-NEXT: Body: 4183808080000B
; CHECK-NEXT: - Index: 10
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 41020B
@@ -165,25 +165,25 @@
; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Index: 12
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 418C888080000B
+; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Index: 13
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4190888080000B
+; CHECK-NEXT: Body: 418C888080000B
; CHECK-NEXT: - Index: 14
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4194888080000B
+; CHECK-NEXT: Body: 4190888080000B
; CHECK-NEXT: - Index: 15
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4184808080000B
+; CHECK-NEXT: Body: 4194888080000B
; CHECK-NEXT: - Index: 16
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4185808080000B
+; CHECK-NEXT: Body: 4184808080000B
; CHECK-NEXT: - Index: 17
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4186808080000B
+; CHECK-NEXT: Body: 4185808080000B
; CHECK-NEXT: - Index: 18
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 4186808080000B
; CHECK-NEXT: - Type: DATA
; CHECK-NEXT: Segments:
; CHECK-NEXT: - SectionOffset: 7
@@ -196,43 +196,43 @@
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: colliding_func1
+; CHECK-NEXT: Name: __wasm_call_ctors
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Name: colliding_func2
+; CHECK-NEXT: Name: colliding_func1
; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Name: colliding_func3
+; CHECK-NEXT: Name: colliding_func2
; CHECK-NEXT: - Index: 3
-; CHECK-NEXT: Name: get_global1A
+; CHECK-NEXT: Name: colliding_func3
; CHECK-NEXT: - Index: 4
-; CHECK-NEXT: Name: get_global2A
+; CHECK-NEXT: Name: get_global1A
; CHECK-NEXT: - Index: 5
-; CHECK-NEXT: Name: get_global3A
+; CHECK-NEXT: Name: get_global2A
; CHECK-NEXT: - Index: 6
-; CHECK-NEXT: Name: get_func1A
+; CHECK-NEXT: Name: get_global3A
; CHECK-NEXT: - Index: 7
-; CHECK-NEXT: Name: get_func2A
+; CHECK-NEXT: Name: get_func1A
; CHECK-NEXT: - Index: 8
-; CHECK-NEXT: Name: get_func3A
+; CHECK-NEXT: Name: get_func2A
; CHECK-NEXT: - Index: 9
-; CHECK-NEXT: Name: colliding_func1
+; CHECK-NEXT: Name: get_func3A
; CHECK-NEXT: - Index: 10
-; CHECK-NEXT: Name: colliding_func2
+; CHECK-NEXT: Name: colliding_func1
; CHECK-NEXT: - Index: 11
-; CHECK-NEXT: Name: colliding_func3
+; CHECK-NEXT: Name: colliding_func2
; CHECK-NEXT: - Index: 12
-; CHECK-NEXT: Name: get_global1B
+; CHECK-NEXT: Name: colliding_func3
; CHECK-NEXT: - Index: 13
-; CHECK-NEXT: Name: get_global2B
+; CHECK-NEXT: Name: get_global1B
; CHECK-NEXT: - Index: 14
-; CHECK-NEXT: Name: get_global3B
+; CHECK-NEXT: Name: get_global2B
; CHECK-NEXT: - Index: 15
-; CHECK-NEXT: Name: get_func1B
+; CHECK-NEXT: Name: get_global3B
; CHECK-NEXT: - Index: 16
-; CHECK-NEXT: Name: get_func2B
+; CHECK-NEXT: Name: get_func1B
; CHECK-NEXT: - Index: 17
-; CHECK-NEXT: Name: get_func3B
+; CHECK-NEXT: Name: get_func2B
; CHECK-NEXT: - Index: 18
-; CHECK-NEXT: Name: __wasm_call_ctors
+; CHECK-NEXT: Name: get_func3B
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/undefined-weak-call.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/undefined-weak-call.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/undefined-weak-call.ll (original)
+++ lld/trunk/test/wasm/undefined-weak-call.ll Mon Mar 12 08:44:07 2018
@@ -29,17 +29,17 @@ define i32 @callWeakFuncs() {
; CHECK-NEXT: - Type: TYPE
; CHECK-NEXT: Signatures:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: ReturnType: I32
+; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
+; CHECK-NEXT: - I32
; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: ReturnType: NORESULT
+; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
-; CHECK-NEXT: - I32
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 1, 2 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 0, 0, 1, 2 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: ANYFUNC
@@ -83,15 +83,15 @@ define i32 @callWeakFuncs() {
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: callWeakFuncs
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 0
+; CHECK-NEXT: Index: 4
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 10828080800010838080800041021084808080004180808080004180808080006A0B
+; CHECK-NEXT: Body: 0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 000B
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 000B
@@ -100,18 +100,18 @@ define i32 @callWeakFuncs() {
; CHECK-NEXT: Body: 000B
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 000B
+; CHECK-NEXT: Body: 10818080800010828080800041021083808080004180808080004180808080006A0B
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: callWeakFuncs
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: undefined function weakFunc1
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: undefined function weakFunc2
-; CHECK-NEXT: - Index: 4
+; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Name: undefined function weakFunc3
+; CHECK-NEXT: - Index: 4
+; CHECK-NEXT: Name: callWeakFuncs
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/visibility-hidden.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/visibility-hidden.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/visibility-hidden.ll (original)
+++ lld/trunk/test/wasm/visibility-hidden.ll Mon Mar 12 08:44:07 2018
@@ -44,11 +44,11 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: objectDefault
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: archiveDefault
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 4
+; CHECK-NEXT: Index: 5
; CHECK-NEXT: - Type:
Modified: lld/trunk/test/wasm/weak-alias-overide.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/weak-alias-overide.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/weak-alias-overide.ll (original)
+++ lld/trunk/test/wasm/weak-alias-overide.ll Mon Mar 12 08:44:07 2018
@@ -26,13 +26,13 @@ entry:
; CHECK-NEXT: - Type: TYPE
; CHECK-NEXT: Signatures:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: ReturnType: I32
+; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: ReturnType: NORESULT
+; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 1, 0, 0, 0, 0, 0, 1 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 1, 0, 1, 1, 1, 1, 1 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: ANYFUNC
@@ -76,78 +76,78 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: alias_fn
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 0
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: direct_fn
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: call_direct
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 4
; CHECK-NEXT: - Name: call_alias
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 4
+; CHECK-NEXT: Index: 5
; CHECK-NEXT: - Name: call_alias_ptr
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 5
+; CHECK-NEXT: Index: 6
; CHECK-NEXT: - Name: call_direct_ptr
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 6
+; CHECK-NEXT: Index: 7
; CHECK-NEXT: - Type: ELEM
; CHECK-NEXT: Segments:
; CHECK-NEXT: - Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1
-; CHECK-NEXT: Functions: [ 0, 2 ]
+; CHECK-NEXT: Functions: [ 1, 3 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41010B
+; CHECK-NEXT: Body: 0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1080808080001A0B
+; CHECK-NEXT: Body: 41010B
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41000B
+; CHECK-NEXT: Body: 1081808080001A0B
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1082808080000B
+; CHECK-NEXT: Body: 41000B
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1080808080000B
+; CHECK-NEXT: Body: 1083808080000B
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Locals:
-; CHECK-NEXT: - Type: I32
-; CHECK-NEXT: Count: 2
-; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081080808080002101200041106A24808080800020010B
+; CHECK-NEXT: Body: 1081808080000B
; CHECK-NEXT: - Index: 6
; CHECK-NEXT: Locals:
; CHECK-NEXT: - Type: I32
; CHECK-NEXT: Count: 2
-; CHECK-NEXT: Body: 23808080800041106B220024808080800020004182808080003602081082808080002101200041106A24808080800020010B
+; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081081808080002101200041106A24808080800020010B
; CHECK-NEXT: - Index: 7
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: - Type: I32
+; CHECK-NEXT: Count: 2
+; CHECK-NEXT: Body: 23808080800041106B220024808080800020004182808080003602081083808080002101200041106A24808080800020010B
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: alias_fn
+; CHECK-NEXT: Name: __wasm_call_ctors
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Name: _start
+; CHECK-NEXT: Name: alias_fn
; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Name: direct_fn
+; CHECK-NEXT: Name: _start
; CHECK-NEXT: - Index: 3
-; CHECK-NEXT: Name: call_direct
+; CHECK-NEXT: Name: direct_fn
; CHECK-NEXT: - Index: 4
-; CHECK-NEXT: Name: call_alias
+; CHECK-NEXT: Name: call_direct
; CHECK-NEXT: - Index: 5
-; CHECK-NEXT: Name: call_alias_ptr
+; CHECK-NEXT: Name: call_alias
; CHECK-NEXT: - Index: 6
-; CHECK-NEXT: Name: call_direct_ptr
+; CHECK-NEXT: Name: call_alias_ptr
; CHECK-NEXT: - Index: 7
-; CHECK-NEXT: Name: __wasm_call_ctors
+; CHECK-NEXT: Name: call_direct_ptr
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/weak-alias.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/weak-alias.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/weak-alias.ll (original)
+++ lld/trunk/test/wasm/weak-alias.ll Mon Mar 12 08:44:07 2018
@@ -29,7 +29,7 @@ entry:
; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 1, 1, 1, 0 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 0, 1, 1, 1, 1, 1 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: ANYFUNC
@@ -73,75 +73,75 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 0
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: alias_fn
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: direct_fn
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: call_direct
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: call_alias
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 4
; CHECK-NEXT: - Name: call_alias_ptr
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 4
+; CHECK-NEXT: Index: 5
; CHECK-NEXT: - Name: call_direct_ptr
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 5
+; CHECK-NEXT: Index: 6
; CHECK-NEXT: - Type: ELEM
; CHECK-NEXT: Segments:
; CHECK-NEXT: - Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1
-; CHECK-NEXT: Functions: [ 1 ]
+; CHECK-NEXT: Functions: [ 2 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1081808080001A0B
+; CHECK-NEXT: Body: 0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41000B
+; CHECK-NEXT: Body: 1082808080001A0B
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1081808080000B
+; CHECK-NEXT: Body: 41000B
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1081808080000B
+; CHECK-NEXT: Body: 1082808080000B
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Locals:
-; CHECK-NEXT: - Type: I32
-; CHECK-NEXT: Count: 2
-; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081081808080002101200041106A24808080800020010B
+; CHECK-NEXT: Body: 1082808080000B
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Locals:
; CHECK-NEXT: - Type: I32
; CHECK-NEXT: Count: 2
-; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081081808080002101200041106A24808080800020010B
+; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081082808080002101200041106A24808080800020010B
; CHECK-NEXT: - Index: 6
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: - Type: I32
+; CHECK-NEXT: Count: 2
+; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081082808080002101200041106A24808080800020010B
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: _start
+; CHECK-NEXT: Name: __wasm_call_ctors
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Name: direct_fn
+; CHECK-NEXT: Name: _start
; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Name: call_direct
+; CHECK-NEXT: Name: direct_fn
; CHECK-NEXT: - Index: 3
-; CHECK-NEXT: Name: call_alias
+; CHECK-NEXT: Name: call_direct
; CHECK-NEXT: - Index: 4
-; CHECK-NEXT: Name: call_alias_ptr
+; CHECK-NEXT: Name: call_alias
; CHECK-NEXT: - Index: 5
-; CHECK-NEXT: Name: call_direct_ptr
+; CHECK-NEXT: Name: call_alias_ptr
; CHECK-NEXT: - Index: 6
-; CHECK-NEXT: Name: __wasm_call_ctors
+; CHECK-NEXT: Name: call_direct_ptr
; CHECK-NEXT: ...
; RUN: wasm-ld --check-signatures --relocatable %t.o %t2.o -o %t.reloc.o
Modified: lld/trunk/test/wasm/weak-symbols.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/weak-symbols.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/weak-symbols.ll (original)
+++ lld/trunk/test/wasm/weak-symbols.ll Mon Mar 12 08:44:07 2018
@@ -29,7 +29,7 @@ entry:
; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 1, 1, 0 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 0, 1, 1, 1, 1 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: ANYFUNC
@@ -79,45 +79,45 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 0
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: weakFn
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: exportWeak1
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: weakGlobal
; CHECK-NEXT: Kind: GLOBAL
; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: exportWeak2
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 4
+; CHECK-NEXT: Index: 5
; CHECK-NEXT: - Type: ELEM
; CHECK-NEXT: Segments:
; CHECK-NEXT: - Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1
-; CHECK-NEXT: Functions: [ 1 ]
+; CHECK-NEXT: Functions: [ 2 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1081808080001A0B
+; CHECK-NEXT: Body: 0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41010B
+; CHECK-NEXT: Body: 1082808080001A0B
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4181808080000B
+; CHECK-NEXT: Body: 41010B
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41020B
+; CHECK-NEXT: Body: 4181808080000B
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4181808080000B
+; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 4181808080000B
; CHECK-NEXT: - Type: DATA
; CHECK-NEXT: Segments:
; CHECK-NEXT: - SectionOffset: 7
@@ -130,15 +130,15 @@ entry:
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: _start
+; CHECK-NEXT: Name: __wasm_call_ctors
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Name: weakFn
+; CHECK-NEXT: Name: _start
; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Name: exportWeak1
-; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Name: weakFn
+; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: Name: exportWeak1
; CHECK-NEXT: - Index: 4
-; CHECK-NEXT: Name: exportWeak2
+; CHECK-NEXT: Name: weakFn
; CHECK-NEXT: - Index: 5
-; CHECK-NEXT: Name: __wasm_call_ctors
+; CHECK-NEXT: Name: exportWeak2
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/weak-undefined.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/weak-undefined.ll?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/test/wasm/weak-undefined.ll (original)
+++ lld/trunk/test/wasm/weak-undefined.ll Mon Mar 12 08:44:07 2018
@@ -33,13 +33,13 @@ entry:
; CHECK-NEXT: - Type: TYPE
; CHECK-NEXT: Signatures:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: ReturnType: I32
+; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: ReturnType: NORESULT
+; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 0, 1, 1 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 0 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: ANYFUNC
@@ -83,25 +83,25 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: get_address_of_foo
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 0
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: get_address_of_global_var
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4180808080000B
+; CHECK-NEXT: Body: 0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4180808080000B
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1081808080001A0B
+; CHECK-NEXT: Body: 4180808080000B
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 1082808080001A0B
; CHECK-NEXT: ...
Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=327286&r1=327285&r2=327286&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Mon Mar 12 08:44:07 2018
@@ -757,17 +757,15 @@ void Writer::assignIndexes() {
Func->setOutputIndex(FunctionIndex++);
};
+ for (InputFunction *Func : Symtab->SyntheticFunctions)
+ AddDefinedFunction(Func);
+
for (ObjFile *File : Symtab->ObjectFiles) {
DEBUG(dbgs() << "Functions: " << File->getName() << "\n");
for (InputFunction *Func : File->Functions)
AddDefinedFunction(Func);
}
- // TODO Move synthetic functions to come before (so __wasm_call_ctors can be
- // compiled immediately by the browser). Will reorder tests.
- for (InputFunction *Func : Symtab->SyntheticFunctions)
- AddDefinedFunction(Func);
-
uint32_t TableIndex = kInitialTableOffset;
auto HandleRelocs = [&](InputChunk *Chunk) {
if (!Chunk->Live)
More information about the llvm-commits
mailing list