From 4b0f59afccb060fd7bfd9b107a21bd8a0fdac775 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Thu, 12 May 2022 00:05:03 +0200 Subject: [PATCH] binutils: add upstream patch to fix issue with parallel use of dlltool https://sourceware.org/bugzilla/show_bug.cgi?id=28885 Patch taken from the upstream binutils-2_38-branch branch. --- .../tools/misc/binutils/default.nix | 6 ++++ .../deterministic-temp-prefixes.patch | 36 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 pkgs/development/tools/misc/binutils/deterministic-temp-prefixes.patch diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index da2b4864552e..88b6d3a705e8 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -82,6 +82,12 @@ stdenv.mkDerivation { # override this behavior, forcing ld to search DT_RPATH even when # cross-compiling. ./always-search-rpath.patch + + # Fixed in 2.39 + # https://sourceware.org/bugzilla/show_bug.cgi?id=28885 + # https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=99852365513266afdd793289813e8e565186c9e6 + # https://github.com/NixOS/nixpkgs/issues/170946 + ./deterministic-temp-prefixes.patch ] ++ lib.optional targetPlatform.isiOS ./support-ios.patch # This patch was suggested by Nick Clifton to fix diff --git a/pkgs/development/tools/misc/binutils/deterministic-temp-prefixes.patch b/pkgs/development/tools/misc/binutils/deterministic-temp-prefixes.patch new file mode 100644 index 000000000000..3c27340b9c04 --- /dev/null +++ b/pkgs/development/tools/misc/binutils/deterministic-temp-prefixes.patch @@ -0,0 +1,36 @@ +From 99852365513266afdd793289813e8e565186c9e6 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Wed, 23 Mar 2022 11:39:49 +0000 +Subject: [PATCH] dlltool: Use the output name as basis for deterministic temp + prefixes + + PR 28885 + * dlltool.c (main): use imp_name rather than dll_name when + generating a temporary file name. +--- + binutils/ChangeLog | 9 +++++++++ + binutils/dlltool.c | 7 ++++--- + 2 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/binutils/dlltool.c b/binutils/dlltool.c +index d95bf3f5470..89871510b45 100644 +--- a/binutils/dlltool.c ++++ b/binutils/dlltool.c +@@ -3992,10 +3992,11 @@ main (int ac, char **av) + if (tmp_prefix == NULL) + { + /* If possible use a deterministic prefix. */ +- if (dll_name) ++ if (imp_name || delayimp_name) + { +- tmp_prefix = xmalloc (strlen (dll_name) + 2); +- sprintf (tmp_prefix, "%s_", dll_name); ++ const char *input = imp_name ? imp_name : delayimp_name; ++ tmp_prefix = xmalloc (strlen (input) + 2); ++ sprintf (tmp_prefix, "%s_", input); + for (i = 0; tmp_prefix[i]; i++) + if (!ISALNUM (tmp_prefix[i])) + tmp_prefix[i] = '_'; +-- +2.31.1 +