diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix index 4d6fb5a54b39..c2776a157764 100644 --- a/pkgs/development/libraries/glibc/common.nix +++ b/pkgs/development/libraries/glibc/common.nix @@ -36,6 +36,7 @@ , withLinuxHeaders ? false , profilingLibraries ? false , withGd ? false +, enableCET ? false , extraBuildInputs ? [] , extraNativeBuildInputs ? [] , ... @@ -154,9 +155,9 @@ stdenv.mkDerivation ({ # and on aarch64 with binutils 2.30 or later. # https://sourceware.org/glibc/wiki/PortStatus "--enable-static-pie" - ] ++ lib.optionals stdenv.hostPlatform.isx86_64 [ + ] ++ lib.optionals (enableCET != false) [ # Enable Intel Control-flow Enforcement Technology (CET) support - "--enable-cet" + "--enable-cet${if builtins.isString enableCET then "=${enableCET}" else ""}" ] ++ lib.optionals withLinuxHeaders [ "--enable-kernel=3.10.0" # RHEL 7 and derivatives, seems oldest still supported kernel ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ @@ -208,7 +209,7 @@ stdenv.mkDerivation ({ passthru = { inherit version; minorRelease = version; }; } -// (removeAttrs args [ "withLinuxHeaders" "withGd" "postInstall" "makeFlags" ]) // +// (removeAttrs args [ "withLinuxHeaders" "withGd" "enableCET" "postInstall" "makeFlags" ]) // { src = fetchurl { diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix index 3f7331461fea..e07c354aa4e0 100644 --- a/pkgs/development/libraries/glibc/default.nix +++ b/pkgs/development/libraries/glibc/default.nix @@ -2,6 +2,7 @@ , withLinuxHeaders ? true , profilingLibraries ? false , withGd ? false +, enableCET ? if stdenv.hostPlatform.isx86_64 then "permissive" else false , pkgsBuildBuild , libgcc }: @@ -15,7 +16,7 @@ let in (callPackage ./common.nix { inherit stdenv; } { - inherit withLinuxHeaders withGd profilingLibraries; + inherit withLinuxHeaders withGd profilingLibraries enableCET; pname = "glibc" + lib.optionalString withGd "-gd" + lib.optionalString (stdenv.cc.isGNU && libgcc==null) "-nolibgcc"; }).overrideAttrs(previousAttrs: {