pkgsStatic: Pass hostPlatform.gcc attribute

To build the security wrappers[1] the pkgsStatic stdenv is used, so the
binaries are static. However, the hostPlatform may have gcc attributes
that are *required* to build binaries so they can run on the host
platform. In particular, this is the case when using gcc.arch, which
ends up injecting -march=... in the gcc wrapper. Those attributes are
not contained in hostPlatform.parsed.

This change sets the same gcc attributes found in the hostPlatform for
the pkgsStatic cross system, so it can build binaries with the same gcc
flags.

[1]: nixos/modules/security/wrappers/default.nix

+2 -2
+2 -2
pkgs/top-level/stage.nix
··· 272 272 if stdenv.isLinux 273 273 then makeMuslParsedPlatform stdenv.hostPlatform.parsed 274 274 else stdenv.hostPlatform.parsed; 275 - } // lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") { 276 - gcc.abi = "elfv2"; 275 + gcc = lib.optionalAttrs (stdenv.hostPlatform.system == "powerpc64-linux") { abi = "elfv2"; } // 276 + stdenv.hostPlatform.gcc or {}; 277 277 }; 278 278 }); 279 279 };