From 6b43416bca1dd6b510b944e55c5716e4b35d7e10 Mon Sep 17 00:00:00 2001 From: Preston Evans Date: Fri, 17 Jun 2022 08:55:07 -0500 Subject: [PATCH] Update C compiler flags for riscv32im --- secp256k1-sys/build.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/secp256k1-sys/build.rs b/secp256k1-sys/build.rs index 9163c480a..31e6dba7c 100644 --- a/secp256k1-sys/build.rs +++ b/secp256k1-sys/build.rs @@ -42,13 +42,18 @@ fn main() { .define("USE_SCALAR_INV_BUILTIN", Some("1")) .compiler("/usr/local/opt/llvm/bin/clang") .flag("--sysroot=/opt/riscv/riscv32-unknown-elf") // https://github.com/riscv-collab/riscv-gnu-toolchain has been built and stored in /opt/riscv - .flag("--gcc-toolchain=/opt/riscv/") + .flag("--gcc-toolchain=/opt/riscv") // https://github.com/riscv-collab/riscv-gnu-toolchain has been built and stored in /opt/riscv + .no_default_flags(true) + .flag("-O3") + .flag("--target=riscv32-unknown-none-elf") + .flag("-mabi=ilp32") + .flag("-mcmodel=medany") .flag("-Os") .flag("-fdata-sections") .flag("-ffunction-sections") - .flag("-Wl") .flag("-dead_strip") .flag("-flto") + .flag("-march=rv32im") .target("riscv32-unknown-none-elf"); if cfg!(feature = "lowmemory") {