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

risc-v: Set ABI correctly for 32-bit targets #429

Merged
merged 1 commit into from
Aug 8, 2019
Merged

risc-v: Set ABI correctly for 32-bit targets #429

merged 1 commit into from
Aug 8, 2019

Conversation

laanwj
Copy link
Contributor

@laanwj laanwj commented Aug 8, 2019

Pick the correct softfloat mode based on bitness:

  • -mabi=lp64 for 64 bit RISC-V (longs and pointers 64 bit, integers 32 bit, no fp registers)
  • -mabi=ilp32 for 32-bit RISC-V (integers, longs and pointers 32-bit, no fp registers)

Currently it fails for rv32 due to a conflict between the ABI and arch:

cc1: error: ABI requires -march=rv64

ref: rust-lang/rust#60012 (comment)

Pick the correct softfloat mode based on bitness:

- `-mabi=lp64` for 64 bit RISC-V
- `-mabi=ilp32` for 32-bit RISC-V

Currently it fails for rv32 due to a conflict between the ABI and arch:

    cc1: error: ABI requires -march=rv64
@alexcrichton alexcrichton merged commit c7cd5dd into rust-lang:master Aug 8, 2019
Centril added a commit to Centril/rust that referenced this pull request Nov 15, 2019
Update cc, git2, num_cpus.

This updates the `cc` crate, bringing in better parallel building support. Also updates `git2` which enables the parallel feature. (Note: I don't expect it will have a significant impact on build time, but seems good to update anyways.)

The main thorn is that `cc` gained knowledge about RISC-V architectures (rust-lang/cc-rs#428, rust-lang/cc-rs#429, rust-lang/cc-rs#430), but the builders on CI do not have the riscv C compiler installed. This means that bootstraps' cc detection was finding a C compiler that isn't installed, and fails.

The solution here is to override the cc detection to `false`. The C compiler isn't actually used on riscv platforms. AFAIK, the only location would be compiler_builtins, and it currently forces C support off (https://github.com/rust-lang/compiler-builtins/blob/a533ae9c5aa325db209659679535fe1f186eae81/build.rs#L49-L55).

Other possible solutions:
- Add the override in cc_detect for riscv (or any "no-C" platform like wasm32 and nvptx)
- Install and use the appropriate c compiler. I tried this the `g++-riscv64-linux-gnu` package, but it failed missing some header file.

Closes rust-lang#66232
bors added a commit to rust-lang/rust that referenced this pull request Nov 16, 2019
Update cc, git2, num_cpus.

This updates the `cc` crate, bringing in better parallel building support. Also updates `git2` which enables the parallel feature. (Note: I don't expect it will have a significant impact on build time, but seems good to update anyways.)

The main thorn is that `cc` gained knowledge about RISC-V architectures (rust-lang/cc-rs#428, rust-lang/cc-rs#429, rust-lang/cc-rs#430), but the builders on CI do not have the riscv C compiler installed. This means that bootstraps' cc detection was finding a C compiler that isn't installed, and fails.

The solution here is to override the cc detection to `false`. The C compiler isn't actually used on riscv platforms. AFAIK, the only location would be compiler_builtins, and it currently forces C support off (https://github.com/rust-lang/compiler-builtins/blob/a533ae9c5aa325db209659679535fe1f186eae81/build.rs#L49-L55).

Other possible solutions:
- Add the override in cc_detect for riscv (or any "no-C" platform like wasm32 and nvptx)
- Install and use the appropriate c compiler. I tried this the `g++-riscv64-linux-gnu` package, but it failed missing some header file.

Closes #66232
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