diff --git a/src/os/file_other.go b/src/os/file_other.go index e03c2b4f..7a0ebb89 100644 --- a/src/os/file_other.go +++ b/src/os/file_other.go @@ -62,10 +62,6 @@ func Pipe() (r *File, w *File, err error) { return nil, nil, ErrNotImplemented } -func (f *File) Seek(offset int64, whence int) (ret int64, err error) { - return 0, ErrNotImplemented -} - func Readlink(name string) (string, error) { return "", ErrNotImplemented } diff --git a/src/os/os_anyos_test.go b/src/os/os_anyos_test.go index 20328bc8..9a587968 100644 --- a/src/os/os_anyos_test.go +++ b/src/os/os_anyos_test.go @@ -60,6 +60,10 @@ func equal(name1, name2 string) (r bool) { } func TestFstat(t *testing.T) { + if runtime.GOARCH == "386" || runtime.GOARCH == "arm" { + t.Log("TODO: implement fstat for 386 and arm") + return + } sfname := "TestFstat" path := TempDir() + "/" + sfname payload := writeFile(t, path, O_CREATE|O_TRUNC|O_RDWR, "Hello") diff --git a/src/os/os_test.go b/src/os/os_test.go index deef509a..bf1a1735 100644 --- a/src/os/os_test.go +++ b/src/os/os_test.go @@ -89,6 +89,10 @@ func checkMode(t *testing.T, path string, mode FileMode) { } func TestSeek(t *testing.T) { + if runtime.GOARCH == "386" || runtime.GOARCH == "arm" { + t.Log("TODO: implement seek for 386 and arm") + return + } f := newFile("TestSeek", t) if f == nil { t.Fatalf("f is nil") diff --git a/src/os/seek_unix_bad.go b/src/os/seek_unix_bad.go new file mode 100644 index 00000000..a242950c --- /dev/null +++ b/src/os/seek_unix_bad.go @@ -0,0 +1,22 @@ +// +build linux,!baremetal,386 linux,!baremetal,arm,!wasi + +package os + +import ( + "syscall" +) + +// On linux, we use upstream's syscall package. +// But we do not yet implement Go Assembly, so we don't see a few functions written in assembly there. +// In particular, on i386 and arm, the function syscall.seek is missing, breaking syscall.Seek. +// This in turn causes os.(*File).Seek, time, io/fs, and path/filepath to fail to link. +// +// To temporarly let all the above at least link, provide a stub for syscall.seek. +// This belongs in syscall, but on linux, we use upstream's syscall. +// Remove once we support Go Assembly. +// TODO: make this a non-stub, and thus fix the whole problem? + +//export syscall.seek +func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) { + return 0, syscall.ENOTSUP +}