From 574d1e47ea9fa29f6a6ad3f2222d982aa48af940 Mon Sep 17 00:00:00 2001 From: pennae Date: Fri, 10 Mar 2023 07:10:23 +0100 Subject: [PATCH 1/2] avrlibc: enable parallel builds this cuts about 80% off the build time with no apparent negative effects. --- pkgs/development/misc/avr/libc/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/misc/avr/libc/default.nix b/pkgs/development/misc/avr/libc/default.nix index ac9da31fcc0f8..9b3ac75d11046 100644 --- a/pkgs/development/misc/avr/libc/default.nix +++ b/pkgs/development/misc/avr/libc/default.nix @@ -15,6 +15,8 @@ stdenv.mkDerivation rec { stripDebugList = [ "bin" ]; dontPatchELF = true; + enableParallelBuilding = true; + passthru = { incdir = "/avr/include"; }; From b2844f89d10d4a2665aed231144950c354f275a6 Mon Sep 17 00:00:00 2001 From: pennae Date: Fri, 10 Mar 2023 07:26:28 +0100 Subject: [PATCH 2/2] avrlibc: hook up libdir for cc-wrapper -B must be set to the root directory of avrlibc, otherwise gcc cannot locate crt objects for some attiny devices. -L trains as set by bintools-wrapper are not necessary with -B set correctly because gcc takes care of that, and likewise we can drop the -B train from cc-wrapper because the one spec is enough. --- pkgs/build-support/bintools-wrapper/default.nix | 6 ------ pkgs/build-support/cc-wrapper/default.nix | 6 ------ pkgs/development/misc/avr/libc/default.nix | 1 + 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index ccd342eaa0d19..dd6032fc52cfa 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -301,12 +301,6 @@ stdenv.mkDerivation { hardening_unsupported_flags+=" relro bindnow" '' - + optionalString (libc != null && targetPlatform.isAvr) '' - for isa in avr5 avr3 avr4 avr6 avr25 avr31 avr35 avr51 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tiny-stack; do - echo "-L${getLib libc}/avr/lib/$isa" >> $out/nix-support/libc-cflags - done - '' - + optionalString stdenv.targetPlatform.isDarwin '' echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags '' diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 8ac11436c5f7b..539c29a0a7743 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -649,12 +649,6 @@ stdenv.mkDerivation { hardening_unsupported_flags+=" stackprotector" '' - + optionalString (libc != null && targetPlatform.isAvr) '' - for isa in avr5 avr3 avr4 avr6 avr25 avr31 avr35 avr51 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tiny-stack; do - echo "-B${getLib libc}/avr/lib/$isa" >> $out/nix-support/libc-crt1-cflags - done - '' - + optionalString stdenv.targetPlatform.isDarwin '' echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/cc-cflags '' diff --git a/pkgs/development/misc/avr/libc/default.nix b/pkgs/development/misc/avr/libc/default.nix index 9b3ac75d11046..d7e9f0efe9992 100644 --- a/pkgs/development/misc/avr/libc/default.nix +++ b/pkgs/development/misc/avr/libc/default.nix @@ -19,6 +19,7 @@ stdenv.mkDerivation rec { passthru = { incdir = "/avr/include"; + libdir = "/avr/lib"; }; meta = with lib; {