Add hardening flags. Add RUSTFLAGS optimisation level.

This commit is contained in:
inference 2023-02-28 21:53:18 +00:00
parent 16a5b6fc1c
commit 82fa71dd63
Signed by: inference
SSH Key Fingerprint: SHA256:9Pl0nZ2UJacgm+IeEtLSZ4FOESgP1eKCtRflfPfdX9M

View File

@ -4,13 +4,16 @@
# Copyright 2022-2023 Inference # Copyright 2022-2023 Inference
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# Version: 6.0.0.9 # Version: 7.0.0.10
# Flags # Flags
# Hardening flags
C_SEC="-fstack-clash-protection -fstack-protector-strong -ftrivial-auto-var-init=zero -fwrapv"
LD_SEC="-Wl,-z,defs -Wl,-z,now -Wl,-z,relro"
## Compiler flags ## Compiler flags
CFLAGS="-march=znver3 -mtune=znver3 -O2 -pipe" CFLAGS="-march=znver3 -mtune=znver3 -O2 -pipe ${C_SEC}"
CXXFLAGS="-march=znver3 -mtune=znver3 -O2 -pipe" CXXFLAGS="-march=znver3 -mtune=znver3 -O2 -pipe ${C_SEC}"
RUSTFLAGS="-C debuginfo=0 -C target-cpu=znver3" RUSTFLAGS="-C debuginfo=0 -C opt-level=2 -C target-cpu=znver3"
## Linker flags ## Linker flags
LDFLAGS="-Wl,-O2 -Wl,--strip-all" LDFLAGS="-Wl,-O2 -Wl,--strip-all ${LD_SEC}"