nixpkgs/pkgs/development/tools/misc/binutils/2.38/deterministic-temp-prefixes.patch
Sergei Trofimovich 7fe41f922e libbfd_2_38, libopcodes_2_38: create held back release
2.39 has an API breakage that will take users some time to migrate.
Create _2_38 versions to allow them to hand on an old version for a
while.
2022-08-23 19:56:03 +01:00

37 lines
1.2 KiB
Diff

From 99852365513266afdd793289813e8e565186c9e6 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
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