1From 99852365513266afdd793289813e8e565186c9e6 Mon Sep 17 00:00:00 2001
2From: Nick Clifton <nickc@redhat.com>
3Date: Wed, 23 Mar 2022 11:39:49 +0000
4Subject: [PATCH] dlltool: Use the output name as basis for deterministic temp
5 prefixes
6
7 PR 28885
8 * dlltool.c (main): use imp_name rather than dll_name when
9 generating a temporary file name.
10---
11 binutils/ChangeLog | 9 +++++++++
12 binutils/dlltool.c | 7 ++++---
13 2 files changed, 13 insertions(+), 3 deletions(-)
14
15diff --git a/binutils/dlltool.c b/binutils/dlltool.c
16index 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)
21 {
22 /* If possible use a deterministic prefix. */
23- if (dll_name)
24+ if (imp_name || delayimp_name)
25 {
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]))
33 tmp_prefix[i] = '_';
34--
352.31.1
36