From d5fb429c7dcaaabde24d4efb8d96c97ecb356a63 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Wed, 20 Jul 2022 16:38:08 +0800 Subject: [PATCH 1/2] cc-wrapper: Set correct hardening_unsupported_flags for newlib-nano --- pkgs/build-support/cc-wrapper/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index d74d0490b409..623457bc7b9a 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -474,7 +474,7 @@ stdenv.mkDerivation { hardening_unsupported_flags+=" stackprotector fortify" '' + optionalString targetPlatform.isAvr '' hardening_unsupported_flags+=" stackprotector pic" - '' + optionalString (targetPlatform.libc == "newlib") '' + '' + optionalString (targetPlatform.libc == "newlib" || targetPlatform.libc == "newlib-nano") '' hardening_unsupported_flags+=" stackprotector fortify pie pic" '' + optionalString (targetPlatform.libc == "musl" && targetPlatform.isx86_32) '' hardening_unsupported_flags+=" stackprotector" From facbbae4b7cb818569024a7bd1dbddf1bbdd4c35 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Wed, 20 Jul 2022 16:39:49 +0800 Subject: [PATCH 2/2] gcc: Set --with-newlib when using newlib-nano --- pkgs/development/compilers/gcc/common/configure-flags.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix index 910d93d42da1..68f87b3c2fe5 100644 --- a/pkgs/development/compilers/gcc/common/configure-flags.nix +++ b/pkgs/development/compilers/gcc/common/configure-flags.nix @@ -97,7 +97,7 @@ let # In uclibc cases, libgomp needs an additional '-ldl' # and as I don't know how to pass it, I disable libgomp. "--disable-libgomp" - ] ++ lib.optional (targetPlatform.libc == "newlib") "--with-newlib" + ] ++ lib.optional (targetPlatform.libc == "newlib" || targetPlatform.libc == "newlib-nano") "--with-newlib" ++ lib.optional (targetPlatform.libc == "avrlibc") "--with-avrlibc" );