-
Notifications
You must be signed in to change notification settings - Fork 996
stub runtime_{Before,After}Exec for linkage #4426
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
stub runtime_{Before,After}Exec for linkage #4426
Conversation
|
I think you are addressing an important issue here, that has not been taken care of atm. |
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? |
leongross
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked out your changes and built the failing cmdlet switch_root with it and this works just fine.
For context: The previous errors were:
ld.lld: error: undefined symbol: syscall.runtime_BeforeExec
>>> referenced by exec_unix.go:279 (/usr/lib/golang/src/syscall/exec_unix.go:279)
>>> /tmp/tinygo131981138/main.lto.main.o:(runtime.run$1$gowrapper)
ld.lld: error: undefined symbol: syscall.runtime_AfterExec
>>> referenced by exec_unix.go:305 (/usr/lib/golang/src/syscall/exec_unix.go:305)
>>> /tmp/tinygo131981138/main.lto.main.o:(runtime.run$1$gowrapper)
failed to run tool: ld.lld
error: failed to link /tmp/tinygo131981138/main: exit status 1
| // Used in BigGo to serialize exec / thread creation. Stubbing to | ||
| // satisfy link. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put this maybe before the function to generate the doc string?
| @@ -0,0 +1,19 @@ | |||
| // Copyright 2014 The Go Authors. All rights reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
| // Copyright 2014 The Go Authors. All rights reserved. | |
| // Copyright 2024 The Go Authors. All rights reserved. |
|
On a kind of related note: #4384 implements the missing signals so the linker does not break the compilation |
|
Thank you for the PR @archie2x and to @leongross for review. Now merging. |
|
Thanks @deadprogram for merging. |
Fixes:
I copied BigGo/src/runtime/proc.go for this, duplicating the
//go:linknameIn 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 ?