make.conf.flags 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # vim: ft=gentoo-make-conf:cc=80:
  2. _MARCH=native
  3. _SAFEST_FAST_MATH="-fno-math-errno -fno-trapping-math"
  4. _UNSAFE_MATH="-fno-signed-zeros -fassociative-math -freciprocal-math"
  5. _FAST_MATH="-fno-math-errno -ffinite-math-only -fno-rounding-math"
  6. _MATH_FLAGS="${_SAFEST_FAST_MATH} ${_FAST_MATH} ${_UNSAFE_MATH}"
  7. _F_OPTIMIZE="-falign-functions=32 -ftree-vectorize -funroll-loops"
  8. _SAFE_FLAGS="-march=${_MARCH} -O3 -flto -fPIC ${_F_OPTIMIZE}"
  9. _OPT="${_SAFE_FLAGS} ${_MATH_FLAGS}"
  10. _SECURITY_STACK="-fstack-protector-all -fstack-protector-strong
  11. -fstack-clash-protection"
  12. _SECURITY="${_SECURITY_STACK} -fPIE -fcf-protection -D_FORTIFY_SOURCE=2 ${_HARDENING_CFLAGS}"
  13. _LD_SECURITY="-Wl,-z,now -Wl,-z,relro ${_HARDENING_LDFLAGS}"
  14. _MUSL_FLAGS="-D_LARGEFILE64_SOURCE"
  15. _RUST_STATIC="-Ctarget-feature=-crt-static"
  16. #_RUST_STATIC="${_RUST_STATIC} -Clink-self-contained=yes"
  17. _RUST_OPT="-Ctarget-cpu=${_MARCH} -Copt-level=3"
  18. _RUST_LINK="--defsym=__dm9pZCAq_binary__=0x0c,-O4,--as-needed,-z,now,-z,relro"
  19. RUSTFLAGS="${RUSTFLAGS} -Clink-args=-Wl,${_RUST_LINK} ${_RUST_OPT} ${_RUST_STATIC}"
  20. COMMON_FLAGS="${COMMON_FLAGS} -pipe ${_OPT} ${_SECURITY} ${_MUSL_FLAGS} "
  21. LDFLAGS="${LDFLAGS} -Wl,-O4 -Wl,--as-needed ${_LD_SECURITY}"
  22. #ECARGO_EXTRA_ARGS="--target=x86_64-unknown-linux-musl"