forked from bytecodealliance/wasm-tools
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support
_initialize
export as well as __wasm_call_ctors
Per WebAssembly/tool-conventions#203 and recent LLVM and wasi-libc changes, libraries may export an `_initialize` function instead of `__wasm_call_ctors`, and we should call whichever one we find. Note that we expect to find at most one of the two, and will return an error if both are found. Signed-off-by: Joel Dice <joel.dice@fermyon.com>
- Loading branch information
Showing
15 changed files
with
503 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
crates/wit-component/tests/components/error-link-duplicate-initializers/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
library foo exports both `__wasm_call_ctors` and `_initialize`; expected at most one of the two |
12 changes: 12 additions & 0 deletions
12
crates/wit-component/tests/components/error-link-duplicate-initializers/lib-bar.wat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(module | ||
(@dylink.0 | ||
(mem-info (memory 0 4)) | ||
(needed "foo") | ||
) | ||
(type (func (param i32) (result i32))) | ||
(import "env" "foo" (func $import_foo (type 0))) | ||
(func $bar (type 0) (param i32) (result i32) | ||
unreachable | ||
) | ||
(export "bar" (func $bar)) | ||
) |
3 changes: 3 additions & 0 deletions
3
crates/wit-component/tests/components/error-link-duplicate-initializers/lib-bar.wit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package test:test; | ||
|
||
world lib-bar { } |
21 changes: 21 additions & 0 deletions
21
crates/wit-component/tests/components/error-link-duplicate-initializers/lib-foo.wat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
(module | ||
(@dylink.0 | ||
(mem-info (memory 0 4)) | ||
(needed "bar") | ||
) | ||
(type (func (param i32) (result i32))) | ||
(type (func)) | ||
(import "test:test/test" "foo" (func $import_foo (type 0))) | ||
(import "env" "foo" (func $import_foo2 (type 0))) | ||
(import "env" "bar" (func $import_bar (type 0))) | ||
(func $foo (type 0) (param i32) (result i32) | ||
unreachable | ||
) | ||
(func $_initialize (type 1) | ||
unreachable | ||
) | ||
(export "test:test/test#foo" (func $foo)) | ||
(export "foo" (func $foo)) | ||
(export "_initialize" (func $_initialize)) | ||
(export "__wasm_call_ctors" (func $_initialize)) | ||
) |
10 changes: 10 additions & 0 deletions
10
crates/wit-component/tests/components/error-link-duplicate-initializers/lib-foo.wit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package test:test; | ||
|
||
interface test { | ||
foo: func(v: s32) -> s32; | ||
} | ||
|
||
world lib-foo { | ||
import test; | ||
export test; | ||
} |
Oops, something went wrong.