tinygo
tinygo copied to clipboard
runtime: add runtime.fcntl link directives
Building u-root commands with tinygo (see https://github.com/u-root/u-root/issues/2979) returns linking errors for the system runtime function runtime.fcntl. This PR intends to fix this issue. Affected u-root cmdlets:
- localboot
- netbootxyz
- newsshd
- systemboot
I am perplexed by the linker's behavior. After reconsidering your design choices, what I want to do is the following:
- create function
Fcntlinsyscall_unixandsyscall_libc - in
os_linuxadd the function declaration forfcntl - link the syscall function over the
runtime.fcntlfunction (since we cannot import the syscall package due to circular dependencies)
I tried:
- link the
runtime/fcnltfunction tosyscall.Fcntl-> did not work - link the
syscall.Fcntlfunction(s) toruntime.fcntl-> did not work - declare
runtime.fcntlas linkable (//go:linkname fcntl) and link from the syscall package up -> did not work
I realized it only worked when I defined runtime.fcntl to return nothing. I would really appreciate your input on this.