Skip to content
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

darwin: use custom syscall pkg that uses libsystem #249

Merged
merged 1 commit into from
Apr 5, 2019
Merged

Conversation

aykevl
Copy link
Member

@aykevl aykevl commented Mar 24, 2019

Go 1.12 switched to using libSystem.dylib for system calls, because
Apple recommends against doing direct system calls that Go 1.11 and
earlier did. For more information, see:
golang/go#17490
https://developer.apple.com/library/archive/qa/qa1118/_index.html

While the old syscall package was relatively easy to support in TinyGo
(just implement syscall.Syscall*), this got a whole lot harder with Go
1.12 as all syscalls now go through CGo magic to call the underlying
libSystem functions. Therefore, this commit overrides the stdlib syscall
package with a custom package that performs calls with libc (libSystem).
This may be useful not just for darwin but for other platforms as well
that do not place the stable ABI at the syscall boundary like Linux but
at the libc boundary.

Only a very minimal part of the syscall package has been implemented, to
get the tests to pass. More calls can easily be added in the future.


I have verified that Go 1.11 still works in https://travis-ci.com/tinygo-org/tinygo/builds/105580983. To avoid making the build even slower than it is already, I've left out tests for Go 1.11. Basic Go 1.11 compatibility is tested on CircleCI (Linux) anyway.

@deadprogram
Copy link
Member

@aykevl seems like it would be a good idea to rebase the current dev branch into this branch. Certainly will make it easier to test with all the other recent changes, by then just checking it out locally on a Mac.

Go 1.12 switched to using libSystem.dylib for system calls, because
Apple recommends against doing direct system calls that Go 1.11 and
earlier did. For more information, see:
  golang/go#17490
  https://developer.apple.com/library/archive/qa/qa1118/_index.html

While the old syscall package was relatively easy to support in TinyGo
(just implement syscall.Syscall*), this got a whole lot harder with Go
1.12 as all syscalls now go through CGo magic to call the underlying
libSystem functions. Therefore, this commit overrides the stdlib syscall
package with a custom package that performs calls with libc (libSystem).
This may be useful not just for darwin but for other platforms as well
that do not place the stable ABI at the syscall boundary like Linux but
at the libc boundary.

Only a very minimal part of the syscall package has been implemented, to
get the tests to pass. More calls can easily be added in the future.
@aykevl
Copy link
Member Author

aykevl commented Apr 4, 2019

rebased

@deadprogram
Copy link
Member

Now passes all tests, so merging. An excellent beginning!

@deadprogram deadprogram merged commit 86f8778 into dev Apr 5, 2019
@aykevl aykevl deleted the go1.12-darwin branch April 13, 2019 15:22
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.

2 participants