Skip to content

Commit

Permalink
Add the extra-syscalls feature, which reduces code size.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Nov 15, 2023
1 parent bf27fa5 commit 79a1d0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,10 @@ be-std = []
# Should c-scape's `memcpy` etc. use compiler-builtins?
use-compiler-builtins = ["c-gull/use-compiler-builtins"]

# This extends the `syscall` function with suppport for more syscalls. This is
# not enabled by default because it increases the code size of `syscall` by
# several kibibytes and isn't needed by most Rust programs.
extra-syscalls = ["c-gull/extra-syscalls"]

# Enable `todo!()` stubs for unimplemented functions.
todo = ["c-gull/todo"]
8 changes: 4 additions & 4 deletions example-crates/hello-world-small/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ $ RUSTFLAGS="-Zlocation-detail=none -C relocation-model=static -Ctarget-feature=
This applies all the techniques described on the [min-sized-rust] page
before [Remove `core::fmt` with `no_main` and Careful Usage of `libstd`].

As of this writing, using all these same optimizations without Eyra, using
`x86_64-unknown-linux-musl` (which produces smaller statically-linked binaries
than `x86_64-unknown-linux-gnu`), compiles to 50776 bytes, while this Eyra
example currently compiles to 37912 bytes.
As of this writing, this compiles to 37880 bytes. For comparison, usinig all
these same optimizations without Eyra, and using `x86_64-unknown-linux-musl`
(which produces smaller statically-linked binaries than
`x86_64-unknown-linux-gnu`), compiles to 50776 bytes.

If you're interested in going further down the `#![no_main]`/`#![no_std]`
path, consider [using Origin directly] which can get down to 408 bytes. Or,
Expand Down

0 comments on commit 79a1d0e

Please sign in to comment.