1 From 99852365513266afdd793289813e8e565186c9e6 Mon Sep 17 00:00:00 2001
2 From: Nick Clifton <nickc@redhat.com>
3 Date: Wed, 23 Mar 2022 11:39:49 +0000
4 Subject: [PATCH] dlltool: Use the output name as basis for deterministic temp
8 * dlltool.c (main): use imp_name rather than dll_name when
9 generating a temporary file name.
11 binutils/ChangeLog | 9 +++++++++
12 binutils/dlltool.c | 7 ++++---
13 2 files changed, 13 insertions(+), 3 deletions(-)
15 diff --git a/binutils/dlltool.c b/binutils/dlltool.c
16 index d95bf3f5470..89871510b45 100644
17 --- a/binutils/dlltool.c
18 +++ b/binutils/dlltool.c
19 @@ -3992,10 +3992,11 @@ main (int ac, char **av)
20 if (tmp_prefix == NULL)
22 /* If possible use a deterministic prefix. */
24 + if (imp_name || delayimp_name)
26 - tmp_prefix = xmalloc (strlen (dll_name) + 2);
27 - sprintf (tmp_prefix, "%s_", dll_name);
28 + const char *input = imp_name ? imp_name : delayimp_name;
29 + tmp_prefix = xmalloc (strlen (input) + 2);
30 + sprintf (tmp_prefix, "%s_", input);
31 for (i = 0; tmp_prefix[i]; i++)
32 if (!ISALNUM (tmp_prefix[i]))