Linker refactoring (#1773)

* Minor code tidying.

* Document that `Linker::iter`'s iteration order is arbitrary.

* Add a few more tests for `wasmtime::Linker`.

* Refactor `Linker::compute_imports`.

 - Extract the error message generation into a separate function.
 - In the error message, sort the candidates.

* Fix a typo in a comment.

* Add `__rtti_base` to the list of allowed but deprecated exports.

* Don't print an Error message when a program exits normally.

* Update comments to reflect the current code.

* Also allow "table" as an exported table, which is used by AssemblyScript.
This commit is contained in:
Dan Gohman
2020-05-28 13:28:05 -07:00
committed by GitHub
parent a96ad96c39
commit ce757f12d1
5 changed files with 117 additions and 50 deletions

View File

@@ -162,8 +162,6 @@ impl RunCommand {
// a message and exit.
if let Some(trap) = e.downcast_ref::<Trap>() {
// Print the error message in the usual way.
eprintln!("Error: {:?}", e);
if let Some(status) = trap.i32_exit_status() {
// On Windows, exit status 3 indicates an abort (see below),
// so return 1 indicating a non-zero status to avoid ambiguity.
@@ -173,6 +171,8 @@ impl RunCommand {
process::exit(status);
}
eprintln!("Error: {:?}", e);
// If the program exited because of a trap, return an error code
// to the outside environment indicating a more severe problem
// than a simple failure.