From bdaa0e2930b71c80ea34fe09ff4f1b1ea8f7ca34 Mon Sep 17 00:00:00 2001 From: Jacek Galowicz Date: Thu, 9 Dec 2021 15:53:51 +0000 Subject: [PATCH] make-binary-wrapper: Add sanitizer default option --- pkgs/top-level/all-packages.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1f291fd6c5b..ce6d8feb0d8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -607,12 +607,19 @@ in ../build-support/setup-hooks/make-wrapper.sh; makeBinaryWrapper = let - script = runCommand "make-binary-wrapper.sh" {} '' - substitute ${../build-support/setup-hooks/make-binary-wrapper.sh} $out \ - --replace " @CC@ " " ${gcc}/bin/cc " - ''; + f = { cc, sanitizers }: let + san = lib.concatMapStringsSep " " (s: "-fsanitize=${s}") sanitizers; + script = runCommand "make-binary-wrapper.sh" {} '' + substitute ${../build-support/setup-hooks/make-binary-wrapper.sh} $out \ + --replace " @CC@ " " ${cc}/bin/cc ${san} " + ''; + in + makeSetupHook { deps = [ dieHook ]; } script; in - makeSetupHook { deps = [ dieHook ]; } script; + lib.makeOverridable f { + cc = gcc; + sanitizers = [ "undefined" "address" ]; + }; makeModulesClosure = { kernel, firmware, rootModules, allowMissing ? false }: callPackage ../build-support/kernel/modules-closure.nix {