public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Martin Storsjö" <martin@martin.st>
To: binutils@sourceware.org
Subject: [PATCH] dlltool: Use the output name as basis for deterministic temp prefixes
Date: Fri, 11 Mar 2022 22:24:50 +0200	[thread overview]
Message-ID: <20220311202450.1760034-1-martin@martin.st> (raw)

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


             reply	other threads:[~2022-03-11 20:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 20:24 Martin Storsjö [this message]
2022-03-16 15:02 ` Nick Clifton
2022-03-23 11:22   ` Martin Storsjö
2022-03-23 11:40     ` Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220311202450.1760034-1-martin@martin.st \
    --to=martin@martin.st \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).