Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ const HURD: &str = "hurd";
const ILLUMOS: &str = "illumos";
const LINUX: &str = "linux";
const NETBSD: &str = "netbsd";
const NONE: &str = "none";
const NTO: &str = "nto";
const OPENBSD: &str = "openbsd";
const REDOX: &str = "redox";
Expand Down Expand Up @@ -605,6 +606,12 @@ fn configure_cc(c: &mut cc::Build, target: &Target, c_root_dir: &Path, include_d
let _ = c.flag(f);
}

if target.os == NONE {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please combine this with the if (target.arch == WASM32) || (target.os == "linux" && target.env == "musl" && target.arch != X86_64) below.

If you need to support GCC then you could change the test in that block to also include is_like_gcc or whatever.

let _ = c.flag("-ffreestanding");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this is correct for all "none" targets, e.g. wasm32v1.

I found when targeting some -none targets in the past that I didn't need to build with -ffreestanding. What happens if we omit it for this target?

Copy link
Copy Markdown
Author

@SimonIT SimonIT Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  cargo:warning=In file included from /mnt/data/Software/Entwicklung/ring/include/ring-core/base.h:26,
  cargo:warning=                 from /mnt/data/Software/Entwicklung/ring/crypto/curve25519/internal.h:18,
  cargo:warning=                 from /mnt/data/Software/Entwicklung/ring/crypto/curve25519/curve25519.c:22:
  cargo:warning=/usr/lib/gcc/riscv64-unknown-elf/10.2.0/include/stdint.h:9:16: fatal error: stdint.h: No such file or directory
  cargo:warning=    9 | # include_next <stdint.h>
  cargo:warning=      |                ^~~~~~~~~~
  cargo:warning=compilation terminated.

The compiler can't find stdint.h.

I'm also not sure what the best filter for that target is

let _ = c.flag("-nostdlib");
let _ = c.define("RING_CORE_NOSTDLIBINC", "1");
}

if APPLE_ABI.contains(&target.os.as_str()) {
// ``-gfull`` is required for Darwin's |-dead_strip|.
let _ = c.flag("-gfull");
Expand Down
3 changes: 3 additions & 0 deletions include/ring-core/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
// Versions of GCC before 10.0 didn't define `__ILP32__` for all 32-bit targets.
#elif defined(__MIPSEL__) || defined(__MIPSEB__) || defined(__PPC__) || defined(__powerpc__) || defined(__csky__) || defined(__XTENSA__)
#define OPENSSL_32_BIT
#elif defined(__riscv) && __riscv_xlen == 32
#define OPENSSL_32_BIT
#define OPENSSL_RISCV32
#else
#error "Unknown target CPU"
#endif
Expand Down