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

Add initial FreeBSD support #810

Merged
merged 1 commit into from Dec 29, 2019
Merged

Add initial FreeBSD support #810

merged 1 commit into from Dec 29, 2019

Conversation

dmgk
Copy link
Contributor

@dmgk dmgk commented Dec 24, 2019

This PR adds initial support for running TinyGo on FreeBSD using self-built LLVM. Both test and smoketest pass and I'm working on adding it to the ports tree.

@aykevl
Copy link
Member

aykevl commented Dec 26, 2019

Looks like this worked by accident. I expected tinygo run ./testdata/stdlib.go (part of make test) to have failed because of missing syscall intrinsics, but looking at the code it doesn't seem to check for GOOS when GOARCH=amd64 (but does this GOOS check for other architectures):

case c.GOARCH() == "amd64":

In any case, I don't have a FreeBSD system ready to test (and my quick attempt to run it in a VM failed) but the changes themselves look good so from my POV it can be merged.

@aykevl
Copy link
Member

aykevl commented Dec 26, 2019

Also: we don't have CI set up at the moment so I'm afraid it may accidentally break in the future. Unfortunately CircleCI doesn't support FreeBSD and I'd rather not add yet another CI system. @dmgk maybe you have any suggestions?

@dmgk
Copy link
Contributor Author

dmgk commented Dec 26, 2019

@aykevl tinygo run ./testdata/stdlib.go currently is expected to fail as I didn't look into supporting FreeBSD as a target yet. This PR is about making tinygo building on FreeBSD and being able to use it to target embedded platforms. Given that, I'm not sure why make test pass.

Although, adding freebsd/amd64 as a target should be fairly easy because AFAIK both Linux and FreeBSD use the same syscall conventions on amd64. Indeed, adding "freebsd" to a case expression in

case "linux":

makes testcase you posted above to pass (on FreeBSD 12.1-STABLE amd64). I'll update the PR shortly.

Regarding CI, the only CI that I know that supports FreeBSD is Cirrus CI which is probably not an option if you already set on CircleCI.

@deadprogram deadprogram changed the base branch from master to dev December 28, 2019 21:21
@deadprogram
Copy link
Member

I am also lacking any way to really test this PR, but looking over the changes they seem sane.

I changed the branch for this PR to dev as mentioned here: https://github.com/tinygo-org/tinygo/blob/master/CONTRIBUTING.md#how-to-use-our-github-repository

@deadprogram
Copy link
Member

It does not negatively impact any other Linux (at least as tested with Ubuntu), so merging as to facilitate more work be able to be done for FreeBSD.

Thank you @dmgk for your contribution.

@deadprogram deadprogram merged commit 71a380c into tinygo-org:dev Dec 29, 2019
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.

None yet

3 participants