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

Completely prebuilt riscv rust toolchain #158

Closed
3 of 4 tasks
dvc94ch opened this issue Aug 10, 2018 · 18 comments
Closed
3 of 4 tasks

Completely prebuilt riscv rust toolchain #158

dvc94ch opened this issue Aug 10, 2018 · 18 comments

Comments

@dvc94ch
Copy link
Member

dvc94ch commented Aug 10, 2018

LLD support for RISCV just landed upstream! llvm-mirror/lld@9e54d15 riscvarchive/riscv-lld#1

  • Wait for rust's llvm/lld to be updated
  • Test lld for the riscv target
  • Enable it in the target spec by default
  • Ship gdb --enable-targets=all with rustup One step setup #43
@danc86
Copy link

danc86 commented Aug 10, 2018

FYI I have been testing lld already (from the rust-lld fork) and we have a bunch of fixes we need to do in riscv-rt... I will post patches soon, was struggling to get past that stuff with #[naked] first :-)

@bradjc
Copy link

bradjc commented Aug 10, 2018

I can help test when this lands in rust nightly.

@danc86
Copy link

danc86 commented Aug 11, 2018

It looks like the lld patch landed in master. Do we know if they will backport it to the 7.x branch?

If they do, do we know if/when rust will rebase its lld 7.x tree?

@dvc94ch
Copy link
Member Author

dvc94ch commented Aug 11, 2018

@danc86 I don't think anyone is going to backport the patch for us. We can submit a PR against rust-lld since a backport might be accepted.

@japaric
Copy link
Member

japaric commented Aug 11, 2018

Instead of backporting the patches you could update the lld fork to the latest upstream version (if it doesn't require updating the llvm fork).

@danc86
Copy link

danc86 commented Aug 12, 2018

Yeah it might be a bit tricky. I noticed that the upstream release_70 branch of lld has accumulated a bunch of commits that depend on new enum values and header changes in the release_70 branch of llvm. So they would have to updated in sync with each other I think.

I am not familiar enough with how llvm and lld do their branches and releases though...

@dvc94ch
Copy link
Member Author

dvc94ch commented Aug 18, 2018

thanks to @danc86 for his work on lld support! rust-lang/lld#1

@danc86
Copy link

danc86 commented Aug 19, 2018

Ah, posting rust-lang/lld#1 was easy :-) all the hard work went into rust-embedded/riscv-rt#10 instead 😅

Alex just merged the lld patch as well, so we should be able to update the riscv32imac-unknown-none-elf target to use rust-lld next!

@danc86
Copy link

danc86 commented Aug 24, 2018

PR to update lld in rust-lang/rust was: rust-lang/rust#53492

It was merged several days ago but there seems to be no new build ready to be rustup'ed just yet.

Once rustup can give you a nightly with working lld I will post another PR to update the riscv32imac-unknown-none-elf target to use it by default.

@dvc94ch
Copy link
Member Author

dvc94ch commented Aug 24, 2018

@danc86 have you tried the c extension recently? This rust-embedded/riscv-rt#8 (comment) likely fixed the issues I was having. I haven't tried it since I'm currently to lazy to build rustc from src 😄

@danc86
Copy link

danc86 commented Aug 24, 2018

You should be able to test +c by just tweaking compiler flags in .cargo/config, right? Or with a custom target spec. I don't think you need to rebuild all of rust.

I haven't tried it myself, will give it a go over the weekend.

I thought we needed the .push(norelax) thingy when setting the global pointer, don't we? Or does that not matter since rust-lld can't actually do the relaxations right now anyway? :-)

@danc86
Copy link

danc86 commented Aug 24, 2018

I also want to go back to gdb and figure out why its stack traces are broken... I've got a laundry list of stuff to investigate when I have some free time over the weekend. :-)

@dvc94ch
Copy link
Member Author

dvc94ch commented Aug 24, 2018

You should be able to test +c by just tweaking compiler flags in .cargo/config, right? Or with a custom target spec. I don't think you need to rebuild all of rust.

Libcore won't be built with the +c flag then. But I guess it's not required for testing purposes...

I thought we needed the .push(norelax) thingy when setting the global pointer, don't we? Or does that not matter since rust-lld can't actually do the relaxations right now anyway? :-)

yes that is what I was thinking...

@danc86
Copy link

danc86 commented Aug 24, 2018

Oh right. I have been using cargo xbuild to rebuild core whenever I fiddle with the target. It seems to work.

@japaric
Copy link
Member

japaric commented Aug 28, 2018

@danc86 @dvc94ch how did the LLD experiments go? People were asking about this (switching the RISCV targets to LLD) on reddit.

@dvc94ch
Copy link
Member Author

dvc94ch commented Aug 28, 2018

Just started testing it today, can't say yet. Building a small example soc that provides embedded hal drivers in a plug and play fashion. So you select the components and get a hal that is for the soc.

@dvc94ch
Copy link
Member Author

dvc94ch commented Aug 30, 2018

Opened a PR rust-lang/rust#53822

@therealprof
Copy link
Contributor

Meanwhile there are a variety of different toolchains available out-of-the-box: https://doc.rust-lang.org/nightly/rustc/platform-support.html

So I think this issue can be considered done.

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

No branches or pull requests

5 participants