Skip to content

Commit

Permalink
unset NIX_HARDENING_ENABLE in fast build mode
Browse files Browse the repository at this point in the history
`NIX_HARDENING_ENABLE` causes `_FORTIFY_SOURCE` to be defined.
This isn't compatible with `-O0`, and the compiler will happily remind
us about it at every call, spamming the terminal with warnings and stack
traces.

We don't really care hardening in that case, so just disable it if we
pass `OPTIMIZE=0`.
  • Loading branch information
Théophane Hufschmitt committed Feb 28, 2024
1 parent da90be7 commit f6142cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ ifeq ($(OPTIMIZE), 1)
GLOBAL_LDFLAGS += $(CXXLTO)
else
GLOBAL_CXXFLAGS += -O0 -U_FORTIFY_SOURCE
unexport NIX_HARDENING_ENABLE
endif

include mk/platform.mk
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@
# Make bash completion work.
XDG_DATA_DIRS+=:$out/share
'';

nativeBuildInputs = attrs.nativeBuildInputs or []
# TODO: Remove the darwin check once
# https://github.com/NixOS/nixpkgs/pull/291814 is available
Expand Down

0 comments on commit f6142cd

Please sign in to comment.