Skip to content

Add LLVM 12 support #2300

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

Merged
merged 1 commit into from
Nov 30, 2021
Merged

Add LLVM 12 support #2300

merged 1 commit into from
Nov 30, 2021

Conversation

aykevl
Copy link
Member

@aykevl aykevl commented Nov 21, 2021

Originally based on a PR by @QuLogic, but extended a lot to get all tests to pass.

Work in progress. The remaining parts is build-linux, which can't complete its run on CircleCI because of the 1 hour job run limit.

@dgryski
Copy link
Member

dgryski commented Nov 21, 2021

Aside from coroutine issues, does this fix any issues that were hitting tinygo?

@aykevl
Copy link
Member Author

aykevl commented Nov 21, 2021

Not directly, but it's important to stay up to date with LLVM. Some reasons:

  • Newer versions have improvements and bug fixes. For example, the heap alignment bug for WebAssembly that's fixed in LLVM 13. Another example: the MachO linker becomes usable in LLVM 12 which means we can cross compile executables for MacOS like we already do for Windows and Linux.
  • Linux distributions prefer to use only a single (recent) LLVM version

Originally based on a PR by @QuLogic, but extended a lot to get all
tests to pass.
@aykevl
Copy link
Member Author

aykevl commented Nov 25, 2021

This is now, finally, ready for review. It took a lot of work (most importantly, #2011) to get LLVM 12 supported but so far all tests seem to be passing.

@niaow niaow self-requested a review November 25, 2021 02:10
@deadprogram
Copy link
Member

Seems like all TinyHCI tests are passing except MAIt BiT which is our only RISC-V 64-bit platform. Have to dig in a little more here. Program compiles and flashes just fine, but no response from serial.

@aykevl
Copy link
Member Author

aykevl commented Nov 25, 2021

Hmm, that's kind of difficult for me to debug as I don't have the hardware. I don't see anything obviously wrong with the binary either.
Can you try debugging this locally? For example with a very small program (I usually use ./testdata/alias.go for this purpose).

One thing you could try is to set the linker to the LLVM 11 linker and see whether that works. You can do this by modifying the maixbit.json file and add

"linker": "ld.lld-11",

(Or similar, depending on how you've installed LLVM).

@deadprogram
Copy link
Member

Using a container with this build, I can determine that even blinky1 does not run on the Maixbit with this branch. The container I used for testing did not have LLVM installed, as it uses the build from the CI. I will have to try a different container for this test.

@aykevl
Copy link
Member Author

aykevl commented Nov 25, 2021

You can also build locally, using go install. You will then need to provide the LLVM version in a tag: go install -tags=llvm11 or go install -tags=llvm12. This PR still defaults to LLVM 11 for go install.

@deadprogram
Copy link
Member

I will setup jlink and gdb to try to look into this a bit more. In the meantime, since it is not commonly used apparently, I have disabled that board from TinyHCI in the interest of getting this PR merged sooner.

Also have installed locally, so I will try out with some of my various demos and toys.

@deadprogram
Copy link
Member

Confirmed that a couple of my Bluetooth examples are working as expected with this branch. As far as I am concerned, we should merge it, and then later look into any specific issues on the Maxibit.

Copy link
Member

@niaow niaow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I tried it out locally and cannot find any issues. Not sure about the maixbit issue.

@deadprogram
Copy link
Member

Thanks @QuLogic for starting this off and @aykevl for finishing it off. Also thanks @niaow and @dgryski for review.

Now merging!

@deadprogram deadprogram merged commit 5127b9d into dev Nov 30, 2021
@deadprogram deadprogram deleted the llvm12 branch November 30, 2021 20:53
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.

4 participants