[lld] r355240 - [WebAssebmly] Allow __wasm_call_ctors to be GC'ed
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 1 14:35:48 PST 2019
Author: sbc
Date: Fri Mar 1 14:35:47 2019
New Revision: 355240
URL: http://llvm.org/viewvc/llvm-project?rev=355240&view=rev
Log:
[WebAssebmly] Allow __wasm_call_ctors to be GC'ed
Differential Revision: https://reviews.llvm.org/D58806
Modified:
lld/trunk/test/wasm/alias.ll
lld/trunk/test/wasm/archive-export.ll
lld/trunk/test/wasm/call-indirect.ll
lld/trunk/test/wasm/comdats.ll
lld/trunk/test/wasm/cxx-mangling.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-imports.ll
lld/trunk/test/wasm/gc-sections.ll
lld/trunk/test/wasm/init-fini.ll
lld/trunk/test/wasm/local-symbols.ll
lld/trunk/test/wasm/locals-duplicate.test
lld/trunk/test/wasm/lto/archive.ll
lld/trunk/test/wasm/lto/export.ll
lld/trunk/test/wasm/lto/lto-start.ll
lld/trunk/test/wasm/lto/used.ll
lld/trunk/test/wasm/shared.ll
lld/trunk/test/wasm/signature-mismatch-export.ll
lld/trunk/test/wasm/signature-mismatch.ll
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/MarkLive.cpp
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=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/alias.ll (original)
+++ lld/trunk/test/wasm/alias.ll Fri Mar 1 14:35:47 2019
@@ -22,7 +22,7 @@ entry:
; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 0 ]
+; CHECK-NEXT: FunctionTypes: [ 0 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: FUNCREF
@@ -66,23 +66,18 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Name: start_alias
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 0B
-; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: _start
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/archive-export.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/archive-export.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/archive-export.ll (original)
+++ lld/trunk/test/wasm/archive-export.ll Fri Mar 1 14:35:47 2019
@@ -22,16 +22,16 @@ CHECK-NEXT: Kind: GLO
CHECK-NEXT: Index: 2
CHECK-NEXT: - Name: foo
CHECK-NEXT: Kind: FUNCTION
-CHECK-NEXT: Index: 2
+CHECK-NEXT: Index: 1
CHECK-NEXT: - Name: bar
CHECK-NEXT: Kind: FUNCTION
-CHECK-NEXT: Index: 3
+CHECK-NEXT: Index: 2
CHECK-NEXT: - Name: archive2_symbol
CHECK-NEXT: Kind: FUNCTION
-CHECK-NEXT: Index: 4
+CHECK-NEXT: Index: 3
CHECK-NEXT: - Name: _start
CHECK-NEXT: Kind: FUNCTION
-CHECK-NEXT: Index: 1
+CHECK-NEXT: Index: 0
CHECK-NEXT: - Type: CODE
NOEXPORT: Exports:
@@ -46,5 +46,5 @@ NOEXPORT-NEXT: Kind:
NOEXPORT-NEXT: Index: 2
NOEXPORT-NEXT: - Name: _start
NOEXPORT-NEXT: Kind: FUNCTION
-NOEXPORT-NEXT: Index: 1
+NOEXPORT-NEXT: Index: 0
NOEXPORT-NEXT: - Type: CODE
Modified: lld/trunk/test/wasm/call-indirect.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/call-indirect.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/call-indirect.ll (original)
+++ lld/trunk/test/wasm/call-indirect.ll Fri Mar 1 14:35:47 2019
@@ -57,7 +57,7 @@ define void @call_ptr(i64 (i64)* %arg) {
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - I32
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 3, 0, 3, 1, 3, 4 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 3, 1, 3, 4 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: FUNCREF
@@ -107,48 +107,45 @@ define void @call_ptr(i64 (i64)* %arg) {
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: bar
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Name: call_bar_indirect
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: foo
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 4
+; 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: 5
+; 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, 3 ]
+; CHECK-NEXT: Functions: [ 0, 2 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
-; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 42010B
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
; CHECK-NEXT: - Type: I32
; CHECK-NEXT: Count: 1
; CHECK-NEXT: Body: 4100280284888080002100410028028088808000118080808000001A2000118180808000001A0B
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 41020B
-; CHECK-NEXT: - Index: 4
+; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 410028028888808000118180808000001A0B
-; CHECK-NEXT: - Index: 5
+; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 42012000118280808000001A0B
; CHECK-NEXT: - Type: DATA
@@ -163,15 +160,13 @@ define void @call_ptr(i64 (i64)* %arg) {
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: bar
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: call_bar_indirect
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: foo
-; CHECK-NEXT: - Index: 4
+; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Name: _start
-; CHECK-NEXT: - Index: 5
+; CHECK-NEXT: - Index: 4
; 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=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/comdats.ll (original)
+++ lld/trunk/test/wasm/comdats.ll Fri Mar 1 14:35:47 2019
@@ -53,40 +53,37 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Name: inlineFn
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: constantData
; CHECK-NEXT: Kind: GLOBAL
; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: callInline1
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: callInline2
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 4
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Type: ELEM
; CHECK-NEXT: Segments:
; CHECK-NEXT: - Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1
-; CHECK-NEXT: Functions: [ 2 ]
+; CHECK-NEXT: Functions: [ 1 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 1081808080001A0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1082808080001A0B
-; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4180888080000B
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4181808080000B
-; CHECK-NEXT: - Index: 4
+; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4181808080000B
; CHECK-NEXT: - Type: DATA
Modified: lld/trunk/test/wasm/cxx-mangling.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/cxx-mangling.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/cxx-mangling.ll (original)
+++ lld/trunk/test/wasm/cxx-mangling.ll Fri Mar 1 14:35:47 2019
@@ -34,35 +34,30 @@ define void @_start() {
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _Z3fooi
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
-; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 000B
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 0B
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 410110828080800041011081808080000B
+; CHECK-NEXT: Body: 410110818080800041011080808080000B
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; DEMANGLE-NEXT: Name: 'undefined:bar(int)'
; MANGLE-NEXT: Name: 'undefined:_Z3bari'
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; DEMANGLE-NEXT: Name: 'foo(int)'
; MANGLE-NEXT: Name: _Z3fooi
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: _start
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/entry.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/entry.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/entry.ll (original)
+++ lld/trunk/test/wasm/entry.ll Fri Mar 1 14:35:47 2019
@@ -25,7 +25,7 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: entry
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Type:
; The __wasm_call_ctors is somewhat special since its created by the linker.
Modified: lld/trunk/test/wasm/export.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/export.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/export.ll (original)
+++ lld/trunk/test/wasm/export.ll Fri Mar 1 14:35:47 2019
@@ -48,11 +48,11 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: hidden_function
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Name: used_function
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 2
; 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=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/function-imports-first.ll (original)
+++ lld/trunk/test/wasm/function-imports-first.ll Fri Mar 1 14:35:47 2019
@@ -24,25 +24,20 @@ declare i32 @ret32(float) local_unnamed_
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - F32
; CHECK: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 0, 1 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 1 ]
; CHECK: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 43000000001081808080001A0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 43000000001082808080001A0B
-; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 41000B
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: _start
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; 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=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/function-imports.ll (original)
+++ lld/trunk/test/wasm/function-imports.ll Fri Mar 1 14:35:47 2019
@@ -18,25 +18,22 @@ declare i32 @ret32(float) local_unnamed_
; CHECK: - 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: - F32
+; CHECK-NEXT: - Index: 1
+; CHECK-NEXT: ReturnType: NORESULT
+; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 1, 0 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 1 ]
; CHECK: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK: - Index: 0
; CHECK: - Index: 1
-; CHECK: - Index: 2
; CHECK: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: ret32
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: _start
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/gc-imports.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/gc-imports.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/gc-imports.ll (original)
+++ lld/trunk/test/wasm/gc-imports.ll Fri Mar 1 14:35:47 2019
@@ -43,10 +43,8 @@ entry:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Name: used_undef_function
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: _start
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: use_undef_global
; 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=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/gc-sections.ll (original)
+++ lld/trunk/test/wasm/gc-sections.ll Fri Mar 1 14:35:47 2019
@@ -38,10 +38,10 @@ entry:
; CHECK: - Type: TYPE
; CHECK-NEXT: Signatures:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: ReturnType: NORESULT
+; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: ReturnType: I32
+; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: ReturnType: I64
@@ -75,12 +75,10 @@ entry:
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: used_function
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: _start
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: use_global
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/init-fini.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/init-fini.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/init-fini.ll (original)
+++ lld/trunk/test/wasm/init-fini.ll Fri Mar 1 14:35:47 2019
@@ -25,6 +25,7 @@ entry:
declare hidden void @externCtor()
declare hidden void @externDtor()
+declare hidden void @__wasm_call_ctors()
define i32 @__cxa_atexit(i32 %func, i32 %arg, i32 %dso_handle) {
ret i32 0
@@ -32,6 +33,7 @@ define i32 @__cxa_atexit(i32 %func, i32
define hidden void @_start() {
entry:
+ call void @__wasm_call_ctors();
ret void
}
@@ -127,202 +129,22 @@ entry:
; CHECK-NEXT: Name: .Lregister_call_dtors.2002
; CHECK-NEXT: ...
-
; RUN: wasm-ld -r %t.o %t.global-ctor-dtor.o -o %t.reloc.wasm
-; RUN: obj2yaml %t.reloc.wasm | FileCheck -check-prefix=RELOC %s
+; RUN: llvm-readobj --symbols --sections %t.reloc.wasm | FileCheck -check-prefix=RELOC %s
-; RELOC: SymbolTable:
-; RELOC-NEXT: - Index: 0
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: func1
-; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ]
-; RELOC-NEXT: Function: 2
-; RELOC-NEXT: - Index: 1
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: func2
-; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ]
-; RELOC-NEXT: Function: 3
-; RELOC-NEXT: - Index: 2
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: func3
-; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ]
-; RELOC-NEXT: Function: 4
-; RELOC-NEXT: - Index: 3
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: func4
-; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ]
-; RELOC-NEXT: Function: 5
-; RELOC-NEXT: - Index: 4
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: __cxa_atexit
-; RELOC-NEXT: Flags: [ ]
-; RELOC-NEXT: Function: 6
-; RELOC-NEXT: - Index: 5
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: _start
-; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ]
-; RELOC-NEXT: Function: 7
-; RELOC-NEXT: - Index: 6
-; RELOC-NEXT: Kind: DATA
-; RELOC-NEXT: Name: __dso_handle
-; RELOC-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN, UNDEFINED ]
-; RELOC-NEXT: - Index: 7
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: externDtor
-; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN, UNDEFINED ]
-; RELOC-NEXT: Function: 0
-; RELOC-NEXT: - Index: 8
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: externCtor
-; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN, UNDEFINED ]
-; RELOC-NEXT: Function: 1
-; RELOC-NEXT: - Index: 9
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: myctor
-; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ]
-; RELOC-NEXT: Function: 14
-; RELOC-NEXT: - Index: 10
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: mydtor
-; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ]
-; RELOC-NEXT: Function: 15
-; RELOC-NEXT: - Index: 11
-; RELOC-NEXT: Kind: GLOBAL
-; RELOC-NEXT: Name: __stack_pointer
-; RELOC-NEXT: Flags: [ UNDEFINED ]
-; RELOC-NEXT: Global: 0
-; RELOC-NEXT: - Index: 12
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: .Lcall_dtors.101
-; RELOC-NEXT: Flags: [ BINDING_LOCAL ]
-; RELOC-NEXT: Function: 8
-; RELOC-NEXT: - Index: 13
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: .Lregister_call_dtors.101
-; RELOC-NEXT: Flags: [ BINDING_LOCAL ]
-; RELOC-NEXT: Function: 9
-; RELOC-NEXT: - Index: 14
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: .Lcall_dtors.1001
-; RELOC-NEXT: Flags: [ BINDING_LOCAL ]
-; RELOC-NEXT: Function: 10
-; RELOC-NEXT: - Index: 15
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: .Lregister_call_dtors.1001
-; RELOC-NEXT: Flags: [ BINDING_LOCAL ]
-; RELOC-NEXT: Function: 11
-; RELOC-NEXT: - Index: 16
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: .Lcall_dtors.4000
-; RELOC-NEXT: Flags: [ BINDING_LOCAL ]
-; RELOC-NEXT: Function: 12
-; RELOC-NEXT: - Index: 17
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: .Lregister_call_dtors.4000
-; RELOC-NEXT: Flags: [ BINDING_LOCAL ]
-; RELOC-NEXT: Function: 13
-; RELOC-NEXT: - Index: 18
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: .Lcall_dtors.101
-; RELOC-NEXT: Flags: [ BINDING_LOCAL ]
-; RELOC-NEXT: Function: 16
-; RELOC-NEXT: - Index: 19
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: .Lregister_call_dtors.101
-; RELOC-NEXT: Flags: [ BINDING_LOCAL ]
-; RELOC-NEXT: Function: 17
-; RELOC-NEXT: - Index: 20
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: .Lcall_dtors.202
-; RELOC-NEXT: Flags: [ BINDING_LOCAL ]
-; RELOC-NEXT: Function: 18
-; RELOC-NEXT: - Index: 21
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: .Lregister_call_dtors.202
-; RELOC-NEXT: Flags: [ BINDING_LOCAL ]
-; RELOC-NEXT: Function: 19
-; RELOC-NEXT: - Index: 22
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: .Lcall_dtors.2002
-; RELOC-NEXT: Flags: [ BINDING_LOCAL ]
-; RELOC-NEXT: Function: 20
-; RELOC-NEXT: - Index: 23
-; RELOC-NEXT: Kind: FUNCTION
-; RELOC-NEXT: Name: .Lregister_call_dtors.2002
-; RELOC-NEXT: Flags: [ BINDING_LOCAL ]
-; RELOC-NEXT: Function: 21
-; RELOC-NEXT: InitFunctions:
-; RELOC-NEXT: - Priority: 101
-; RELOC-NEXT: Symbol: 0
-; RELOC-NEXT: - Priority: 101
-; RELOC-NEXT: Symbol: 1
-; RELOC-NEXT: - Priority: 101
-; RELOC-NEXT: Symbol: 13
-; RELOC-NEXT: - Priority: 101
-; RELOC-NEXT: Symbol: 9
-; RELOC-NEXT: - Priority: 101
-; RELOC-NEXT: Symbol: 19
-; RELOC-NEXT: - Priority: 202
-; RELOC-NEXT: Symbol: 9
-; RELOC-NEXT: - Priority: 202
-; RELOC-NEXT: Symbol: 21
-; RELOC-NEXT: - Priority: 1001
-; RELOC-NEXT: Symbol: 0
-; RELOC-NEXT: - Priority: 1001
-; RELOC-NEXT: Symbol: 15
-; RELOC-NEXT: - Priority: 2002
-; RELOC-NEXT: Symbol: 9
-; RELOC-NEXT: - Priority: 2002
-; RELOC-NEXT: Symbol: 23
-; RELOC-NEXT: - Priority: 4000
-; RELOC-NEXT: Symbol: 8
-; RELOC-NEXT: - Priority: 4000
-; RELOC-NEXT: Symbol: 17
-; RELOC-NEXT: - Type: CUSTOM
-; RELOC-NEXT: Name: name
-; RELOC-NEXT: FunctionNames:
-; RELOC-NEXT: - Index: 0
-; RELOC-NEXT: Name: externDtor
-; RELOC-NEXT: - Index: 1
-; RELOC-NEXT: Name: externCtor
-; RELOC-NEXT: - Index: 2
-; RELOC-NEXT: Name: func1
-; RELOC-NEXT: - Index: 3
-; RELOC-NEXT: Name: func2
-; RELOC-NEXT: - Index: 4
-; RELOC-NEXT: Name: func3
-; RELOC-NEXT: - Index: 5
-; RELOC-NEXT: Name: func4
-; RELOC-NEXT: - Index: 6
-; RELOC-NEXT: Name: __cxa_atexit
-; RELOC-NEXT: - Index: 7
-; RELOC-NEXT: Name: _start
-; RELOC-NEXT: - Index: 8
-; RELOC-NEXT: Name: .Lcall_dtors.101
-; RELOC-NEXT: - Index: 9
-; RELOC-NEXT: Name: .Lregister_call_dtors.101
-; RELOC-NEXT: - Index: 10
-; RELOC-NEXT: Name: .Lcall_dtors.1001
-; RELOC-NEXT: - Index: 11
-; RELOC-NEXT: Name: .Lregister_call_dtors.1001
-; RELOC-NEXT: - Index: 12
-; RELOC-NEXT: Name: .Lcall_dtors.4000
-; RELOC-NEXT: - Index: 13
-; RELOC-NEXT: Name: .Lregister_call_dtors.4000
-; RELOC-NEXT: - Index: 14
-; RELOC-NEXT: Name: myctor
-; RELOC-NEXT: - Index: 15
-; RELOC-NEXT: Name: mydtor
-; RELOC-NEXT: - Index: 16
-; RELOC-NEXT: Name: .Lcall_dtors.101
-; RELOC-NEXT: - Index: 17
-; RELOC-NEXT: Name: .Lregister_call_dtors.101
-; RELOC-NEXT: - Index: 18
-; RELOC-NEXT: Name: .Lcall_dtors.202
-; RELOC-NEXT: - Index: 19
-; RELOC-NEXT: Name: .Lregister_call_dtors.202
-; RELOC-NEXT: - Index: 20
-; RELOC-NEXT: Name: .Lcall_dtors.2002
-; RELOC-NEXT: - Index: 21
-; RELOC-NEXT: Name: .Lregister_call_dtors.2002
-; RELOC-NEXT: ...
+; RELOC: Name: linking
+; RELOC-NEXT: InitFunctions [
+; RELOC-NEXT: 0 (priority=101)
+; RELOC-NEXT: 1 (priority=101)
+; RELOC-NEXT: 14 (priority=101)
+; RELOC-NEXT: 10 (priority=101)
+; RELOC-NEXT: 20 (priority=101)
+; RELOC-NEXT: 10 (priority=202)
+; RELOC-NEXT: 22 (priority=202)
+; RELOC-NEXT: 0 (priority=1001)
+; RELOC-NEXT: 16 (priority=1001)
+; RELOC-NEXT: 10 (priority=2002)
+; RELOC-NEXT: 24 (priority=2002)
+; RELOC-NEXT: 9 (priority=4000)
+; RELOC-NEXT: 18 (priority=4000)
+; RELOC-NEXT: ]
Modified: lld/trunk/test/wasm/local-symbols.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/local-symbols.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/local-symbols.ll (original)
+++ lld/trunk/test/wasm/local-symbols.ll Fri Mar 1 14:35:47 2019
@@ -27,13 +27,13 @@ entry:
; CHECK-NEXT: - Type: TYPE
; CHECK-NEXT: Signatures:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: ReturnType: NORESULT
+; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: ReturnType: I32
+; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 1, 0 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 1 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: FUNCREF
@@ -83,7 +83,7 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: foo
; CHECK-NEXT: Kind: GLOBAL
; CHECK-NEXT: Index: 3
@@ -91,13 +91,10 @@ entry:
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
-; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4100280284888080000B
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1081808080001A0B
+; CHECK-NEXT: Body: 1080808080001A0B
; CHECK-NEXT: - Type: DATA
; CHECK-NEXT: Segments:
; CHECK-NEXT: - SectionOffset: 7
@@ -110,9 +107,7 @@ entry:
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: baz
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; 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=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/locals-duplicate.test (original)
+++ lld/trunk/test/wasm/locals-duplicate.test Fri Mar 1 14:35:47 2019
@@ -10,14 +10,11 @@
; 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-; CHECK-NEXT: 1, 1, 1 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+; CHECK-NEXT: 0, 0 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: FUNCREF
@@ -73,63 +70,63 @@
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: colliding_func2
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: get_global1A
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 4
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: get_global2A
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 5
+; CHECK-NEXT: Index: 4
; 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: 6
+; CHECK-NEXT: Index: 5
; CHECK-NEXT: - Name: get_func1A
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 7
+; CHECK-NEXT: Index: 6
; CHECK-NEXT: - Name: get_func2A
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 8
+; CHECK-NEXT: Index: 7
; CHECK-NEXT: - Name: get_func3A
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 9
+; CHECK-NEXT: Index: 8
; CHECK-NEXT: - Name: colliding_func1
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 10
+; CHECK-NEXT: Index: 9
; CHECK-NEXT: - Name: get_global1B
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 13
+; CHECK-NEXT: Index: 12
; 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: 14
+; CHECK-NEXT: Index: 13
; CHECK-NEXT: - Name: get_global3B
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 15
+; CHECK-NEXT: Index: 14
; CHECK-NEXT: - Name: get_func1B
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 16
+; CHECK-NEXT: Index: 15
; CHECK-NEXT: - Name: get_func2B
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 17
+; CHECK-NEXT: Index: 16
; CHECK-NEXT: - Name: get_func3B
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 18
+; CHECK-NEXT: Index: 17
; CHECK-NEXT: - Type: ELEM
; CHECK-NEXT: Segments:
; CHECK-NEXT: - Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1
-; CHECK-NEXT: Functions: [ 1, 2, 3, 10, 11, 12 ]
+; CHECK-NEXT: Functions: [ 0, 1, 2, 9, 10, 11 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 41020B
@@ -138,25 +135,25 @@
; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41020B
+; CHECK-NEXT: Body: 4180888080000B
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4180888080000B
+; CHECK-NEXT: Body: 4184888080000B
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4184888080000B
+; CHECK-NEXT: Body: 4188888080000B
; CHECK-NEXT: - Index: 6
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4188888080000B
+; CHECK-NEXT: Body: 4181808080000B
; CHECK-NEXT: - Index: 7
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4181808080000B
+; CHECK-NEXT: Body: 4182808080000B
; CHECK-NEXT: - Index: 8
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4182808080000B
+; CHECK-NEXT: Body: 4183808080000B
; CHECK-NEXT: - Index: 9
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4183808080000B
+; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Index: 10
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 41020B
@@ -165,23 +162,20 @@
; CHECK-NEXT: Body: 41020B
; CHECK-NEXT: - Index: 12
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41020B
-; CHECK-NEXT: - Index: 13
-; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 418C888080000B
-; CHECK-NEXT: - Index: 14
+; CHECK-NEXT: - Index: 13
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4190888080000B
-; CHECK-NEXT: - Index: 15
+; CHECK-NEXT: - Index: 14
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4194888080000B
-; CHECK-NEXT: - Index: 16
+; CHECK-NEXT: - Index: 15
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4184808080000B
-; CHECK-NEXT: - Index: 17
+; CHECK-NEXT: - Index: 16
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4185808080000B
-; CHECK-NEXT: - Index: 18
+; CHECK-NEXT: - Index: 17
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4186808080000B
; CHECK-NEXT: - Type: DATA
@@ -196,42 +190,40 @@
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: colliding_func1
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: colliding_func2
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: colliding_func3
-; CHECK-NEXT: - Index: 4
+; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Name: get_global1A
-; CHECK-NEXT: - Index: 5
+; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Name: get_global2A
-; CHECK-NEXT: - Index: 6
+; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Name: get_global3A
-; CHECK-NEXT: - Index: 7
+; CHECK-NEXT: - Index: 6
; CHECK-NEXT: Name: get_func1A
-; CHECK-NEXT: - Index: 8
+; CHECK-NEXT: - Index: 7
; CHECK-NEXT: Name: get_func2A
-; CHECK-NEXT: - Index: 9
+; CHECK-NEXT: - Index: 8
; CHECK-NEXT: Name: get_func3A
-; CHECK-NEXT: - Index: 10
+; CHECK-NEXT: - Index: 9
; CHECK-NEXT: Name: colliding_func1
-; CHECK-NEXT: - Index: 11
+; CHECK-NEXT: - Index: 10
; CHECK-NEXT: Name: colliding_func2
-; CHECK-NEXT: - Index: 12
+; CHECK-NEXT: - Index: 11
; CHECK-NEXT: Name: colliding_func3
-; CHECK-NEXT: - Index: 13
+; CHECK-NEXT: - Index: 12
; CHECK-NEXT: Name: get_global1B
-; CHECK-NEXT: - Index: 14
+; CHECK-NEXT: - Index: 13
; CHECK-NEXT: Name: get_global2B
-; CHECK-NEXT: - Index: 15
+; CHECK-NEXT: - Index: 14
; CHECK-NEXT: Name: get_global3B
-; CHECK-NEXT: - Index: 16
+; CHECK-NEXT: - Index: 15
; CHECK-NEXT: Name: get_func1B
-; CHECK-NEXT: - Index: 17
+; CHECK-NEXT: - Index: 16
; CHECK-NEXT: Name: get_func2B
-; CHECK-NEXT: - Index: 18
+; CHECK-NEXT: - Index: 17
; CHECK-NEXT: Name: get_func3B
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/lto/archive.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/lto/archive.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/lto/archive.ll (original)
+++ lld/trunk/test/wasm/lto/archive.ll Fri Mar 1 14:35:47 2019
@@ -18,8 +18,6 @@ declare void @f()
; CHECK: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: _start
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: f
Modified: lld/trunk/test/wasm/lto/export.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/lto/export.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/lto/export.ll (original)
+++ lld/trunk/test/wasm/lto/export.ll Fri Mar 1 14:35:47 2019
@@ -31,8 +31,8 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: hidden_function
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Type: CODE
Modified: lld/trunk/test/wasm/lto/lto-start.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/lto/lto-start.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/lto/lto-start.ll (original)
+++ lld/trunk/test/wasm/lto/lto-start.ll Fri Mar 1 14:35:47 2019
@@ -6,8 +6,6 @@
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: _start
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
Modified: lld/trunk/test/wasm/lto/used.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/lto/used.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/lto/used.ll (original)
+++ lld/trunk/test/wasm/lto/used.ll Fri Mar 1 14:35:47 2019
@@ -38,8 +38,6 @@ return:
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: _start
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: bar
Modified: lld/trunk/test/wasm/shared.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/shared.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/shared.ll (original)
+++ lld/trunk/test/wasm/shared.ll Fri Mar 1 14:35:47 2019
@@ -68,7 +68,7 @@ declare void @func_external()
; CHECK-NEXT: - Offset:
; CHECK-NEXT: Opcode: GLOBAL_GET
; CHECK-NEXT: Index: 2
-; CHECK-NEXT: Functions: [ 2, 0 ]
+; CHECK-NEXT: Functions: [ 1, 0 ]
; check the data segment initialized with __memory_base global as offset
Modified: lld/trunk/test/wasm/signature-mismatch-export.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/signature-mismatch-export.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/signature-mismatch-export.ll (original)
+++ lld/trunk/test/wasm/signature-mismatch-export.ll Fri Mar 1 14:35:47 2019
@@ -16,17 +16,15 @@ entry:
; CHECK: - Type: EXPORT
; CHECK: - Name: ret32
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 2
; CHECK: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: 'unreachable:ret32'
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: _start
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: ret32
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/signature-mismatch.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/signature-mismatch.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/signature-mismatch.ll (original)
+++ lld/trunk/test/wasm/signature-mismatch.ll Fri Mar 1 14:35:47 2019
@@ -31,23 +31,21 @@ declare i32 @ret32(i32, i64, i32) local_
; YAML: - Type: EXPORT
; YAML: - Name: ret32
; YAML-NEXT: Kind: FUNCTION
-; YAML-NEXT: Index: 3
+; YAML-NEXT: Index: 2
; YAML-NEXT: - Name: call_ret32
; YAML-NEXT: Kind: FUNCTION
-; YAML-NEXT: Index: 4
+; YAML-NEXT: Index: 3
; YAML: - Type: CUSTOM
; YAML-NEXT: Name: name
; YAML-NEXT: FunctionNames:
; YAML-NEXT: - Index: 0
-; YAML-NEXT: Name: __wasm_call_ctors
-; YAML-NEXT: - Index: 1
; YAML-NEXT: Name: 'unreachable:ret32'
-; YAML-NEXT: - Index: 2
+; YAML-NEXT: - Index: 1
; YAML-NEXT: Name: _start
-; YAML-NEXT: - Index: 3
+; YAML-NEXT: - Index: 2
; YAML-NEXT: Name: ret32
-; YAML-NEXT: - Index: 4
+; YAML-NEXT: - Index: 3
; YAML-NEXT: Name: call_ret32
; YAML-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=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/undefined-weak-call.ll (original)
+++ lld/trunk/test/wasm/undefined-weak-call.ll Fri Mar 1 14:35:47 2019
@@ -42,7 +42,7 @@ define i32 @callWeakFuncs() {
; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 0, 0, 1, 2 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 0, 1, 2 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: FUNCREF
@@ -86,12 +86,12 @@ define i32 @callWeakFuncs() {
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: callWeakFuncs
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 4
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 000B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 000B
@@ -100,21 +100,16 @@ define i32 @callWeakFuncs() {
; CHECK-NEXT: Body: 000B
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 000B
-; CHECK-NEXT: - Index: 4
-; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 10818080800010828080800041021083808080004180808080004180808080006A0B
+; CHECK-NEXT: Body: 10808080800010818080800041021082808080004180808080004180808080006A0B
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: 'undefined:weakFunc1'
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: 'undefined:weakFunc2'
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: 'undefined:weakFunc3'
-; CHECK-NEXT: - Index: 4
+; CHECK-NEXT: - Index: 3
; 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=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/visibility-hidden.ll (original)
+++ lld/trunk/test/wasm/visibility-hidden.ll Fri Mar 1 14:35:47 2019
@@ -51,13 +51,13 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: objectDefault
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: archiveDefault
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 5
+; CHECK-NEXT: Index: 4
; CHECK-NEXT: - Type:
@@ -74,5 +74,5 @@ entry:
; NO-DEFAULT-NEXT: Index: 2
; NO-DEFAULT-NEXT: - Name: _start
; NO-DEFAULT-NEXT: Kind: FUNCTION
-; NO-DEFAULT-NEXT: Index: 3
+; NO-DEFAULT-NEXT: Index: 2
; NO-DEFAULT-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=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/weak-alias-overide.ll (original)
+++ lld/trunk/test/wasm/weak-alias-overide.ll Fri Mar 1 14:35:47 2019
@@ -26,13 +26,13 @@ entry:
; CHECK-NEXT: - Type: TYPE
; CHECK-NEXT: Signatures:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: ReturnType: NORESULT
+; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: ReturnType: I32
+; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 1, 0, 1, 1, 1, 1, 1 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 1, 0, 0, 0, 0, 0 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: FUNCREF
@@ -76,78 +76,73 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: alias_fn
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: direct_fn
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: call_direct
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 4
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: call_alias
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 5
+; CHECK-NEXT: Index: 4
; CHECK-NEXT: - Name: call_alias_ptr
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 6
+; CHECK-NEXT: Index: 5
; CHECK-NEXT: - Name: call_direct_ptr
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 7
+; 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, 3 ]
+; CHECK-NEXT: Functions: [ 0, 2 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 41010B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41010B
+; CHECK-NEXT: Body: 1080808080001A0B
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1081808080001A0B
+; CHECK-NEXT: Body: 41000B
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41000B
+; CHECK-NEXT: Body: 1082808080000B
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1083808080000B
+; CHECK-NEXT: Body: 1080808080000B
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1081808080000B
-; CHECK-NEXT: - Index: 6
-; CHECK-NEXT: Locals:
; CHECK-NEXT: - Type: I32
; CHECK-NEXT: Count: 2
-; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081081808080002101200041106A24808080800020010B
-; CHECK-NEXT: - Index: 7
+; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081080808080002101200041106A24808080800020010B
+; CHECK-NEXT: - Index: 6
; CHECK-NEXT: Locals:
; CHECK-NEXT: - Type: I32
; CHECK-NEXT: Count: 2
-; CHECK-NEXT: Body: 23808080800041106B220024808080800020004182808080003602081083808080002101200041106A24808080800020010B
+; CHECK-NEXT: Body: 23808080800041106B220024808080800020004182808080003602081082808080002101200041106A24808080800020010B
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: alias_fn
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: _start
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: direct_fn
-; CHECK-NEXT: - Index: 4
+; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Name: call_direct
-; CHECK-NEXT: - Index: 5
+; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Name: call_alias
-; CHECK-NEXT: - Index: 6
+; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Name: call_alias_ptr
-; CHECK-NEXT: - Index: 7
+; CHECK-NEXT: - Index: 6
; 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=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/weak-alias.ll (original)
+++ lld/trunk/test/wasm/weak-alias.ll Fri Mar 1 14:35:47 2019
@@ -29,7 +29,7 @@ entry:
; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 0, 1, 1, 1, 1, 1 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 1, 1, 1 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: FUNCREF
@@ -73,74 +73,69 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Name: alias_fn
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: direct_fn
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: call_direct
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: call_alias
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 4
+; CHECK-NEXT: Index: 3
; CHECK-NEXT: - Name: call_alias_ptr
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 5
+; CHECK-NEXT: Index: 4
; CHECK-NEXT: - Name: call_direct_ptr
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 6
+; 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: [ 2 ]
+; CHECK-NEXT: Functions: [ 1 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 1081808080001A0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1082808080001A0B
+; CHECK-NEXT: Body: 41000B
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 41000B
+; CHECK-NEXT: Body: 1081808080000B
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1082808080000B
+; CHECK-NEXT: Body: 1081808080000B
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1082808080000B
-; CHECK-NEXT: - Index: 5
-; CHECK-NEXT: Locals:
; CHECK-NEXT: - Type: I32
; CHECK-NEXT: Count: 2
-; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081082808080002101200041106A24808080800020010B
-; CHECK-NEXT: - Index: 6
+; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081081808080002101200041106A24808080800020010B
+; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Locals:
; CHECK-NEXT: - Type: I32
; CHECK-NEXT: Count: 2
-; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081082808080002101200041106A24808080800020010B
+; CHECK-NEXT: Body: 23808080800041106B220024808080800020004181808080003602081081808080002101200041106A24808080800020010B
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: _start
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: direct_fn
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: call_direct
-; CHECK-NEXT: - Index: 4
+; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Name: call_alias
-; CHECK-NEXT: - Index: 5
+; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Name: call_alias_ptr
-; CHECK-NEXT: - Index: 6
+; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Name: call_direct_ptr
; CHECK-NEXT: ...
Modified: lld/trunk/test/wasm/weak-symbols.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/weak-symbols.ll?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/weak-symbols.ll (original)
+++ lld/trunk/test/wasm/weak-symbols.ll Fri Mar 1 14:35:47 2019
@@ -29,7 +29,7 @@ entry:
; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 0, 1, 1, 1 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 1 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: FUNCREF
@@ -79,40 +79,37 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 1
+; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Name: weakFn
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 2
+; CHECK-NEXT: Index: 1
; CHECK-NEXT: - Name: exportWeak1
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 2
; 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: 3
; CHECK-NEXT: - Type: ELEM
; CHECK-NEXT: Segments:
; CHECK-NEXT: - Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1
-; CHECK-NEXT: Functions: [ 2 ]
+; CHECK-NEXT: Functions: [ 1 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 1081808080001A0B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1082808080001A0B
-; CHECK-NEXT: - Index: 2
-; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 41010B
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4181808080000B
-; CHECK-NEXT: - Index: 4
+; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4181808080000B
; CHECK-NEXT: - Type: DATA
@@ -127,13 +124,11 @@ entry:
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: Name: __wasm_call_ctors
-; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: _start
-; CHECK-NEXT: - Index: 2
+; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: weakFn
-; CHECK-NEXT: - Index: 3
+; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: exportWeak1
-; CHECK-NEXT: - Index: 4
+; CHECK-NEXT: - Index: 3
; 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=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/test/wasm/weak-undefined.ll (original)
+++ lld/trunk/test/wasm/weak-undefined.ll Fri Mar 1 14:35:47 2019
@@ -34,13 +34,13 @@ entry:
; CHECK-NEXT: - Type: TYPE
; CHECK-NEXT: Signatures:
; CHECK-NEXT: - Index: 0
-; CHECK-NEXT: ReturnType: NORESULT
+; CHECK-NEXT: ReturnType: I32
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Index: 1
-; CHECK-NEXT: ReturnType: I32
+; CHECK-NEXT: ReturnType: NORESULT
; CHECK-NEXT: ParamTypes:
; CHECK-NEXT: - Type: FUNCTION
-; CHECK-NEXT: FunctionTypes: [ 0, 1, 1, 0 ]
+; CHECK-NEXT: FunctionTypes: [ 0, 0, 1 ]
; CHECK-NEXT: - Type: TABLE
; CHECK-NEXT: Tables:
; CHECK-NEXT: - ElemType: FUNCREF
@@ -84,19 +84,16 @@ entry:
; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
-; CHECK-NEXT: Index: 3
+; CHECK-NEXT: Index: 2
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 0B
+; CHECK-NEXT: Body: 4180808080000B
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 4180808080000B
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 4180808080000B
-; CHECK-NEXT: - Index: 3
-; CHECK-NEXT: Locals:
-; CHECK-NEXT: Body: 1082808080001A1081808080001A0B
+; CHECK-NEXT: Body: 1081808080001A1080808080001A0B
; CHECK-NEXT: ...
Modified: lld/trunk/wasm/MarkLive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/MarkLive.cpp?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/wasm/MarkLive.cpp (original)
+++ lld/trunk/wasm/MarkLive.cpp Fri Mar 1 14:35:47 2019
@@ -38,32 +38,42 @@ void lld::wasm::markLive() {
LLVM_DEBUG(dbgs() << "markLive\n");
SmallVector<InputChunk *, 256> Q;
- auto Enqueue = [&](Symbol *Sym) {
+ std::function<void(Symbol*)> Enqueue = [&](Symbol *Sym) {
if (!Sym || Sym->isLive())
return;
LLVM_DEBUG(dbgs() << "markLive: " << Sym->getName() << "\n");
Sym->markLive();
if (InputChunk *Chunk = Sym->getChunk())
Q.push_back(Chunk);
+
+ // The ctor functions are all referenced by the synthetic CallCtors
+ // function. However, this function does not contain relocations so we
+ // have to manually mark the ctors as live if CallCtors itself is live.
+ if (Sym == WasmSym::CallCtors) {
+ for (const ObjFile *Obj : Symtab->ObjectFiles) {
+ const WasmLinkingData &L = Obj->getWasmObj()->linkingData();
+ for (const WasmInitFunc &F : L.InitFunctions)
+ Enqueue(Obj->getFunctionSymbol(F.Symbol));
+ }
+ }
};
// Add GC root symbols.
if (!Config->Entry.empty())
Enqueue(Symtab->find(Config->Entry));
- Enqueue(WasmSym::CallCtors);
// We need to preserve any exported symbol
for (Symbol *Sym : Symtab->getSymbols())
if (Sym->isExported())
Enqueue(Sym);
- // The ctor functions are all used in the synthetic __wasm_call_ctors
- // function, but since this function is created in-place it doesn't contain
- // relocations which mean we have to manually mark the ctors.
- for (const ObjFile *Obj : Symtab->ObjectFiles) {
- const WasmLinkingData &L = Obj->getWasmObj()->linkingData();
- for (const WasmInitFunc &F : L.InitFunctions)
- Enqueue(Obj->getFunctionSymbol(F.Symbol));
+ // For relocatable output, we need to preserve all the ctor functions
+ if (Config->Relocatable) {
+ for (const ObjFile *Obj : Symtab->ObjectFiles) {
+ const WasmLinkingData &L = Obj->getWasmObj()->linkingData();
+ for (const WasmInitFunc &F : L.InitFunctions)
+ Enqueue(Obj->getFunctionSymbol(F.Symbol));
+ }
}
// Follow relocations to mark all reachable chunks.
Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=355240&r1=355239&r2=355240&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Fri Mar 1 14:35:47 2019
@@ -1137,6 +1137,9 @@ static const int OPCODE_END = 0xb;
// Create synthetic "__wasm_call_ctors" function based on ctor functions
// in input object.
void Writer::createCtorFunction() {
+ if (!WasmSym::CallCtors->isLive())
+ return;
+
// First write the body's contents to a string.
std::string BodyContent;
{
@@ -1169,6 +1172,7 @@ void Writer::calculateInitFunctions() {
const WasmLinkingData &L = File->getWasmObj()->linkingData();
for (const WasmInitFunc &F : L.InitFunctions) {
FunctionSymbol *Sym = File->getFunctionSymbol(F.Symbol);
+ assert(Sym->isLive());
if (*Sym->Signature != WasmSignature{{}, {}})
error("invalid signature for init func: " + toString(*Sym));
InitFunctions.emplace_back(WasmInitEntry{Sym, F.Priority});
More information about the llvm-commits
mailing list