rename size-optimized to size_optimized

This commit is contained in:
Vinzenz Schroeter 2025-05-28 16:48:19 +02:00
parent c7d40b828b
commit a4699b9bc8
4 changed files with 9 additions and 9 deletions

View file

@ -52,6 +52,6 @@ jobs:
- name: install rust targets
run: rustup toolchain install nightly -t aarch64-unknown-linux-gnu -c rust-src --no-self-update
- name: build example -- glibc size-optimized
- name: build example -- glibc size_optimized
run: cd example && make clean
&& make LIBC=gnu LINK=dynamic PROFILE=size-optimized CARGO="rustup run nightly cargo" LTO=1
&& make LIBC=gnu LINK=dynamic PROFILE=size_optimized CARGO="rustup run nightly cargo" LTO=1

View file

@ -40,7 +40,7 @@ missing_safety_doc = "allow"
[package.metadata.docs.rs]
all-features = true
[profile.size-optimized]
[profile.size_optimized]
inherits = "release"
opt-level = 'z' # Optimize for size
lto = true # Enable link-time optimization

View file

@ -11,8 +11,8 @@ ifeq (,$(filter dynamic static,$(_link_type)))
endif
_profile := $(if $(PROFILE),$(PROFILE),release)
ifeq (,$(filter release debug size-optimized,$(_profile)))
_profile := $(error "PROFILE has to be set to one of: debug, release, size-optimized")
ifeq (,$(filter release debug size_optimized,$(_profile)))
_profile := $(error "PROFILE has to be set to one of: debug, release, size_optimized")
endif
ARCH ?= $(shell uname -m)
@ -43,7 +43,7 @@ _rust_cli_profile := $(if $(filter $(_profile),debug),dev,$(_profile))
STRIPFLAGS += -s --strip-unneeded -R .comment -R .gnu.version -R .note -R .note.gnu.build-id -R .note.ABI-tag
STATIC_LINK_LIBS += -lservicepoint_binding_c
size-optimized_CARGOFLAGS += -Zbuild-std="core,std,alloc,proc_macro,panic_abort" \
size_optimized_CARGOFLAGS += -Zbuild-std="core,std,alloc,proc_macro,panic_abort" \
-Zbuild-std-features="panic_immediate_abort"
CARGOFLAGS += --manifest-path=$(REPO_ROOT)/Cargo.toml \
--profile=$(_rust_cli_profile) \
@ -55,7 +55,7 @@ CARGOFLAGS += --manifest-path=$(REPO_ROOT)/Cargo.toml \
CFLAGS += -Wall -Wextra -pedantic -fwhole-program -fPIE -pie
_no_debug_cflags := -ffunction-sections -fdata-sections -Wl,--gc-sections
size-optimized_CFLAGS += -Oz \
size_optimized_CFLAGS += -Oz \
-fwrapv -fomit-frame-pointer -fno-stack-protector\
-fno-unroll-loops \
-fno-unwind-tables -fno-asynchronous-unwind-tables \
@ -74,7 +74,7 @@ debug_CFLAGS += -Og
static_CFLAGS += -static $(STATIC_LINK_LIBS)
dynamic_CFLAGS += -Wl,-Bstatic $(STATIC_LINK_LIBS) -Wl,-Bdynamic
size-optimized_RUSTFLAGS += -Zlocation-detail=none \
size_optimized_RUSTFLAGS += -Zlocation-detail=none \
-Zfmt-debug=none \
-C link-arg=-z,norelro \
-C panic=abort

View file

@ -45,7 +45,7 @@ help:
@echo "Variable | Description | Default | Values"
@echo "---------+----------------------+-----------+---------------------------"
@echo "LIBC | libc to link against | 'gnu' | 'gnu' or 'musl'"
@echo "PROFILE | Optimization profile | 'release' | 'debug' or 'size-optimized'"
@echo "PROFILE | Optimization profile | 'release' | 'debug' or 'size_optimized'"
@echo "LINK | | 'dynamic' | 'dynamic' or 'static'"
@echo "CARGO | cargo binary to use | 'cargo' | 'rustup run nightly cargo'"
@echo "CC | C compiler to use | 'gcc' | 'musl-gcc'"