From 8fd9e1cc1576117c049ef99d43a9c798c9cb9a72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 11 Mar 2022 10:35:35 +0200 Subject: [PATCH] dlltool: Use the output name as basis for deterministic temp prefixes When running multiple dlltool processes in parallel, a temp prefix based on the dll name can cause clashes, if building multiple import libraries that have the same DLL name. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28885 --- binutils/dlltool.c | 7 ++++--- 1 file changed, 4 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.25.1