rename size-optimized to size_optimized
This commit is contained in:
parent
c7d40b828b
commit
a4699b9bc8
4
.github/workflows/rust.yml
vendored
4
.github/workflows/rust.yml
vendored
|
@ -52,6 +52,6 @@ jobs:
|
||||||
- name: install rust targets
|
- name: install rust targets
|
||||||
run: rustup toolchain install nightly -t aarch64-unknown-linux-gnu -c rust-src --no-self-update
|
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
|
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
|
||||||
|
|
|
@ -40,7 +40,7 @@ missing_safety_doc = "allow"
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
||||||
[profile.size-optimized]
|
[profile.size_optimized]
|
||||||
inherits = "release"
|
inherits = "release"
|
||||||
opt-level = 'z' # Optimize for size
|
opt-level = 'z' # Optimize for size
|
||||||
lto = true # Enable link-time optimization
|
lto = true # Enable link-time optimization
|
||||||
|
|
|
@ -11,8 +11,8 @@ ifeq (,$(filter dynamic static,$(_link_type)))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
_profile := $(if $(PROFILE),$(PROFILE),release)
|
_profile := $(if $(PROFILE),$(PROFILE),release)
|
||||||
ifeq (,$(filter release debug size-optimized,$(_profile)))
|
ifeq (,$(filter release debug size_optimized,$(_profile)))
|
||||||
_profile := $(error "PROFILE has to be set to one of: debug, release, size-optimized")
|
_profile := $(error "PROFILE has to be set to one of: debug, release, size_optimized")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ARCH ?= $(shell uname -m)
|
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
|
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
|
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"
|
-Zbuild-std-features="panic_immediate_abort"
|
||||||
CARGOFLAGS += --manifest-path=$(REPO_ROOT)/Cargo.toml \
|
CARGOFLAGS += --manifest-path=$(REPO_ROOT)/Cargo.toml \
|
||||||
--profile=$(_rust_cli_profile) \
|
--profile=$(_rust_cli_profile) \
|
||||||
|
@ -55,7 +55,7 @@ CARGOFLAGS += --manifest-path=$(REPO_ROOT)/Cargo.toml \
|
||||||
|
|
||||||
CFLAGS += -Wall -Wextra -pedantic -fwhole-program -fPIE -pie
|
CFLAGS += -Wall -Wextra -pedantic -fwhole-program -fPIE -pie
|
||||||
_no_debug_cflags := -ffunction-sections -fdata-sections -Wl,--gc-sections
|
_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\
|
-fwrapv -fomit-frame-pointer -fno-stack-protector\
|
||||||
-fno-unroll-loops \
|
-fno-unroll-loops \
|
||||||
-fno-unwind-tables -fno-asynchronous-unwind-tables \
|
-fno-unwind-tables -fno-asynchronous-unwind-tables \
|
||||||
|
@ -74,7 +74,7 @@ debug_CFLAGS += -Og
|
||||||
static_CFLAGS += -static $(STATIC_LINK_LIBS)
|
static_CFLAGS += -static $(STATIC_LINK_LIBS)
|
||||||
dynamic_CFLAGS += -Wl,-Bstatic $(STATIC_LINK_LIBS) -Wl,-Bdynamic
|
dynamic_CFLAGS += -Wl,-Bstatic $(STATIC_LINK_LIBS) -Wl,-Bdynamic
|
||||||
|
|
||||||
size-optimized_RUSTFLAGS += -Zlocation-detail=none \
|
size_optimized_RUSTFLAGS += -Zlocation-detail=none \
|
||||||
-Zfmt-debug=none \
|
-Zfmt-debug=none \
|
||||||
-C link-arg=-z,norelro \
|
-C link-arg=-z,norelro \
|
||||||
-C panic=abort
|
-C panic=abort
|
||||||
|
|
|
@ -45,7 +45,7 @@ help:
|
||||||
@echo "Variable | Description | Default | Values"
|
@echo "Variable | Description | Default | Values"
|
||||||
@echo "---------+----------------------+-----------+---------------------------"
|
@echo "---------+----------------------+-----------+---------------------------"
|
||||||
@echo "LIBC | libc to link against | 'gnu' | 'gnu' or 'musl'"
|
@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 "LINK | | 'dynamic' | 'dynamic' or 'static'"
|
||||||
@echo "CARGO | cargo binary to use | 'cargo' | 'rustup run nightly cargo'"
|
@echo "CARGO | cargo binary to use | 'cargo' | 'rustup run nightly cargo'"
|
||||||
@echo "CC | C compiler to use | 'gcc' | 'musl-gcc'"
|
@echo "CC | C compiler to use | 'gcc' | 'musl-gcc'"
|
||||||
|
|
Loading…
Reference in a new issue