aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-03 20:32:23 +0900
committernsfisis <nsfisis@gmail.com>2025-09-03 20:32:23 +0900
commit256cbd88c53d15884f3519ce75890c7bd1626cb2 (patch)
treeec9944a414d2627fd84f0edfe14e279ae14d2425
parentb845c3cebf6ae86036a85bbdc155def5044c9940 (diff)
downloadducc-256cbd88c53d15884f3519ce75890c7bd1626cb2.tar.gz
ducc-256cbd88c53d15884f3519ce75890c7bd1626cb2.tar.zst
ducc-256cbd88c53d15884f3519ce75890c7bd1626cb2.zip
build: disable hardening of Nix GCC
-rw-r--r--Makefile2
-rw-r--r--flake.nix7
2 files changed, 9 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 3e3a420..773f3d7 100644
--- a/Makefile
+++ b/Makefile
@@ -24,9 +24,11 @@ all: $(BUILD_DIR) $(BUILD_ROOT_DIR)/$(TARGET)
$(BUILD_DIR):
@mkdir -p $(BUILD_DIR)
+# TODO: provide release build?
$(BUILD_ROOT_DIR)/$(TARGET): $(OBJECTS)
$(CC) -Wall -MMD -g -O0 -o $@ $^
+# TODO: provide release build?
$(BUILD_DIR)/%.o: src/%.c
$(CC) -c -Wall -MMD -g -O0 -o $@ $<
diff --git a/flake.nix b/flake.nix
index 385fcc1..5952538 100644
--- a/flake.nix
+++ b/flake.nix
@@ -36,6 +36,10 @@
pname = "ducc";
version = "0.1.0";
src = ./.;
+ # Disable some kinds of hardening to disable GCC optimization.
+ # cf. https://nixos.wiki/wiki/C#Hardening_flags
+ # TODO: provide release build?
+ hardeningDisable = [ "fortify" ];
installPhase = ''
mkdir -p $out/bin
cp build/ducc $out/bin
@@ -46,6 +50,9 @@
packages = [
pkgs.just
];
+ # Disable some kinds of hardening to disable GCC optimization.
+ # cf. https://nixos.wiki/wiki/C#Hardening_flags
+ hardeningDisable = [ "fortify" ];
};
formatter = treefmt.config.build.wrapper;