tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

stub runtime_{Before,After}Exec for linkage

Open archie2x opened this issue 1 year ago • 4 comments
trafficstars

Fixes:

u-root/cmds/core/init$ GOARCH={arm64,amd64} tinygo build -tags noasm
/usr/lib/go-1.22/src/syscall/exec_unix.go:282: linker could not find symbol syscall.runtime_BeforeExec
/usr/lib/go-1.22/src/syscall/exec_unix.go:308: linker could not find symbol syscall.runtime_AfterExec

I copied BigGo/src/runtime/proc.go for this, duplicating the //go:linkname

In BigGo, exec calls are serialized because of golang/go#19546 but uses a rwlock whose implementation would require a lot of file import from BigGo or a merge of tinygo/bigGo runtime against current policy. I may follow this up with a simple sync/Mutex.

@leongross ?

archie2x avatar Aug 21 '24 15:08 archie2x

I think you are addressing an important issue here, that has not been taken care of atm. I tried to implement sth similar bit quite did not get it working, although this would be a great benefit.

leongross avatar Aug 21 '24 16:08 leongross

I think you are addressing an important issue here, that has not been taken care of atm. I tried to implement sth similar bit quite did not get it working, although this would be a great benefit.

I saw your PR. I haven't pulled it / attempted to run it but I think it's missing these stubs for some reason? Does it work without them?

archie2x avatar Aug 23 '24 21:08 archie2x

@aykevl @deadprogram

leongross avatar Aug 27 '24 12:08 leongross

On a kind of related note: https://github.com/tinygo-org/tinygo/pull/4384 implements the missing signals so the linker does not break the compilation

leongross avatar Aug 27 '24 15:08 leongross

Thank you for the PR @archie2x and to @leongross for review. Now merging.

deadprogram avatar Sep 04 '24 21:09 deadprogram

Thanks @deadprogram for merging.

leongross avatar Sep 05 '24 10:09 leongross