From b15493847edca64203a08565863d74dd08961fdc Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 8 Aug 2019 06:52:55 +0000 Subject: [PATCH] risc-v: Set ABI correctly for 32-bit targets 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 --- src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index f3b9343ea..4fe1b34ea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1436,7 +1436,11 @@ impl Build { cmd.args.push(("-march=rv".to_owned() + arch).into()); // ABI is always soft-float right now, update this when this is no longer the // case: - cmd.args.push("-mabi=lp64".into()); + if arch.starts_with("64") { + cmd.args.push("-mabi=lp64".into()); + } else { + cmd.args.push("-mabi=ilp32".into()); + } } } }