-
Notifications
You must be signed in to change notification settings - Fork 17.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wasm: duplicate import in wasip1 compiled binary #60525
Labels
arch-wasm
WebAssembly issues
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Comments
johanbrandhorst
added
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
arch-wasm
WebAssembly issues
labels
May 30, 2023
Also happening for me with this code The duplicate imports for (module
(type (;0;) (func (param i32) (result i32)))
(type (;1;) (func (result i32)))
(type (;2;) (func (param i32)))
(type (;3;) (func (param i32 i32) (result i32)))
(type (;4;) (func (param i32 i64 i32) (result i32)))
(type (;5;) (func (param i32 i32 i32 i32) (result i32)))
(type (;6;) (func (param i32 i32 i32 i64 i32) (result i32)))
(type (;7;) (func (param i32 i32 i32 i32 i32) (result i32)))
(type (;8;) (func (param i32 i32 i32 i32 i32 i64 i64 i32 i32) (result i32)))
(type (;9;) (func (param i32 i32 i32) (result i32)))
(type (;10;) (func (param i64 i64 i64 i64) (result i64)))
(type (;11;) (func (param i64 i64 i64) (result i64)))
(type (;12;) (func (param i64) (result i64)))
(type (;13;) (func (result i64)))
(type (;14;) (func))
(type (;15;) (func (param i64 i64) (result i64)))
(type (;16;) (func (param f64) (result i64)))
(import "wasi_snapshot_preview1" "sched_yield" (func (;0;) (type 1)))
(import "wasi_snapshot_preview1" "proc_exit" (func (;1;) (type 2)))
(import "wasi_snapshot_preview1" "args_get" (func (;2;) (type 3)))
(import "wasi_snapshot_preview1" "args_sizes_get" (func (;3;) (type 3)))
(import "wasi_snapshot_preview1" "clock_time_get" (func (;4;) (type 4)))
(import "wasi_snapshot_preview1" "environ_get" (func (;5;) (type 3)))
(import "wasi_snapshot_preview1" "environ_sizes_get" (func (;6;) (type 3)))
(import "wasi_snapshot_preview1" "fd_write" (func (;7;) (type 5)))
(import "wasi_snapshot_preview1" "random_get" (func (;8;) (type 3)))
(import "wasi_snapshot_preview1" "poll_oneoff" (func (;9;) (type 5)))
(import "wasi_snapshot_preview1" "fd_close" (func (;10;) (type 0)))
(import "wasi_snapshot_preview1" "fd_read" (func (;11;) (type 5)))
(import "wasi_snapshot_preview1" "fd_readdir" (func (;12;) (type 6)))
(import "wasi_snapshot_preview1" "fd_filestat_get" (func (;13;) (type 3)))
(import "wasi_snapshot_preview1" "fd_write" (func (;14;) (type 5)))
(import "wasi_snapshot_preview1" "path_filestat_get" (func (;15;) (type 7)))
(import "wasi_snapshot_preview1" "path_open" (func (;16;) (type 8)))
(import "wasi_snapshot_preview1" "fd_fdstat_get" (func (;17;) (type 3)))
(import "wasi_snapshot_preview1" "fd_fdstat_set_flags" (func (;18;) (type 3)))
(import "wasi_snapshot_preview1" "fd_prestat_get" (func (;19;) (type 3)))
(import "wasi_snapshot_preview1" "fd_prestat_dir_name" (func (;20;) (type 9)))
(func $go_buildid (type 0) (param i32) (result i32) Compiled with
The Golang code package main
import (
"os"
"github.com/sirupsen/logrus"
)
func must(err error) {
if err != nil {
panic(err)
}
}
func main() {
logrus.Infof("start")
pwd, err := os.Getwd()
logrus.Infof("pwd: '%s'", pwd)
must(err)
fs, err := os.ReadDir(".")
must(err)
for _, f := range fs {
logrus.Infof("f: %+v", f)
}
b, err := os.ReadFile("./dep.json")
must(err)
logrus.Infof("The contents are:\n%s", string(b))
logrus.Infof("done")
} The go.mod file
The go.sum file
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
arch-wasm
WebAssembly issues
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?What did you do?
The imports in the generated .wat file are:
Both
fd_write
andrandom_get
appear twice.What did you expect to see?
Each import appears only once
This isn't an invalid wasm file and doesn't affect the end result much, but there is clearly some part of the compiler that isn't weeding out duplicate imports for wasm.
The text was updated successfully, but these errors were encountered: