risc-v: Set ABI correctly for 32-bit targets
authorWladimir J. van der Laan <laanwj@gmail.com>
Thu, 8 Aug 2019 06:52:55 +0000 (06:52 +0000)
committerXimin Luo <infinity0@debian.org>
Sun, 5 Jan 2020 13:35:46 +0000 (13:35 +0000)
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

Gbp-Pq: Name u-riscv64-cc-429.patch

vendor/cc/src/lib.rs

index 8ce062cc349ce891df6261493e3fb97c3e9c5a47..5b36f7d7c04054d067d19305a5a4efdf1a198363 100644 (file)
@@ -1430,7 +1430,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());
+                        }
                     }
                 }
             }