binutils: fix windres not finding the apprioate cross compiler

This commit is contained in:
marius david 2022-01-06 16:16:34 +01:00
parent 466028532d
commit 293c55472a
2 changed files with 21 additions and 1 deletions

View file

@ -94,7 +94,8 @@ stdenv.mkDerivation {
# indeed GHC will refuse to compile with a binutils suffering from it. See
# this comment for more information:
# https://gitlab.haskell.org/ghc/ghc/issues/4210#note_78333
lib.optional (stdenv.targetPlatform.isAarch32 && stdenv.hostPlatform.system != stdenv.targetPlatform.system) ./R_ARM_COPY.patch;
lib.optional (stdenv.targetPlatform.isAarch32 && stdenv.hostPlatform.system != stdenv.targetPlatform.system) ./R_ARM_COPY.patch
++ lib.optional stdenv.targetPlatform.isWindows ./windres-locate-gcc.patch;
outputs = [ "out" "info" "man" ];

View file

@ -0,0 +1,19 @@
diff --git a/binutils/resrc.c b/binutils/resrc.c
index a875c3a4..0411d047 100644
--- a/binutils/resrc.c
+++ b/binutils/resrc.c
@@ -521,7 +521,13 @@ read_rc_file (const char *filename, const char *preprocessor,
cpp_pipe = 0;
- if (dash)
+ /* Nixpkgs specific : look first at the prefixed path
+ ( there should be no gcc in the binutils folder ) */
+ if (slash && dash) {
+ cpp_pipe = look_for_default(cmd, slash + 1, dash - slash, preprocargs, filename);
+ }
+
+ if (dash && ! cpp_pipe)
{
/* First, try looking for a prefixed gcc in the windres
directory, with the same prefix as windres */