Skip to content

(DRAFT) 1.26 support #5166

Draft
dgryski wants to merge 4 commits intotinygo-org:devfrom
dgryski:dgryski/go1.26
Draft

(DRAFT) 1.26 support #5166
dgryski wants to merge 4 commits intotinygo-org:devfrom
dgryski:dgryski/go1.26

Conversation

@dgryski
Copy link
Member

@dgryski dgryski commented Jan 8, 2026

No description provided.

We use this a bunch. Upstream switched to `internal/strconv` which is much heavier.
@dgryski
Copy link
Member Author

dgryski commented Jan 8, 2026

New interp error building hello, world.

~/go/src/github.com/dgryski/hw $ tinygo run main.go
# syscall
/Users/dgryski/go/src/go.googlesource.com/go/src/syscall/syscall_darwin.go:414:27: interp: ptrtoint integer size does not equal pointer size
  %9 = call { i64, i64, i64 } @syscall.rawsyscalln(i64 %fn, ptr %6, i64 %7, i64 %8, ptr undef), !dbg !1069

traceback:
/Users/dgryski/go/src/go.googlesource.com/go/src/syscall/syscall_darwin.go:414:27:
  %9 = call { i64, i64, i64 } @syscall.rawsyscalln(i64 %fn, ptr %6, i64 %7, i64 %8, ptr undef), !dbg !1069
/Users/dgryski/go/src/go.googlesource.com/go/src/syscall/zsyscall_darwin_amd64.go:853:24:
  %1 = call { i64, i64, i64 } @syscall.rawSyscall(i64 ptrtoint (ptr @getrlimit to i64), i64 %which, i64 %0, i64 0, ptr undef), !dbg !1064
/Users/dgryski/go/src/go.googlesource.com/go/src/syscall/rlimit.go:32:21:
  %0 = call %runtime._interface @syscall.Getrlimit(i64 8, ptr %lim, ptr undef), !dbg !1060
/Users/dgryski/go/src/github.com/tinygo-org/tinygo/src/syscall:
  call void @"syscall.init#1"(ptr undef), !dbg !1056

@@ -26,7 +26,7 @@ func NewConfig(options *compileopts.Options) (*compileopts.Config, error) {

// Version range supported by TinyGo.
const minorMin = 19
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't minorMin also match the go.mod version?

@deadprogram
Copy link
Member

@dgryski can we test this branch using #5137 ?

@dgryski
Copy link
Member Author

dgryski commented Jan 24, 2026

@deadprogram We can, but the llvm/syscall issue is going to need work. (Changing CI base won't fix this)

@dgryski
Copy link
Member Author

dgryski commented Mar 13, 2026

Started looking at this again. Seems like the llvm issue is maybe related to https://github.com/tinygo-org/tinygo/blob/release/compiler/syscall.go#L378 .

@dgryski
Copy link
Member Author

dgryski commented Mar 14, 2026

Hmm.. maybe we just need to implement rawsyscalln ?

@dgryski
Copy link
Member Author

dgryski commented Mar 17, 2026

Ok, have a patch to the syscall package that allows code to build and run on mac, but only if interp is disabled. Getting closer...

~/go/src/github.com/dgryski/hw $ tinygo run  -interp-timeout=0 main.go
hello, world
~/go/src/github.com/dgryski/hw $ tinygo version
tinygo version 0.40.1 darwin/amd64 (using go version go1.26.1 and LLVM version 20.1.8)

@dgryski
Copy link
Member Author

dgryski commented Mar 17, 2026

The LLVM IR verify's fine. So it's going to be something with how interp is handling that code. (The patch here is going to be version specific, which is kind of annoying. The shift to rawsyscalln means that all the other syscall* functions are now multiply defined if we include our versions in runtime (since upstream Go has new definitions in syscall..)

@dgryski
Copy link
Member Author

dgryski commented Mar 17, 2026

There's something about the arguments to this Getrlimit call that interp doesn't like. https://go.dev/src/syscall/rlimit.go#L32

@dgryski
Copy link
Member Author

dgryski commented Mar 18, 2026

@niaow Any help with the interp issues would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants