From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by sourceware.org (Postfix) with ESMTPS id 1D00F3858D3C for ; Fri, 11 Mar 2022 20:24:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1D00F3858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=martin.st Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=martin.st Received: by mail-lf1-x12e.google.com with SMTP id w7so17002956lfd.6 for ; Fri, 11 Mar 2022 12:24:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=mXXNt/v6uxqQdvlxYiySmlwr/vu+nlBwnj/Smuwtzqc=; b=Pm3jA9J0lzjSIGIEo/ioKWuCAHWmbxkDuC6nhDziyilivYXUkS2ZhhCA8AvMuXocx4 UYnCU2XfEf7z+5fPWTgY9rClLvBgJK7qkYTDzVXzyGMA+kuvQdkN+nnjBgJejs3sOHQC tv5BWqtBVbrudpInIH2TY6cvSo6FuBkfkw/ePI7toDcit0Sq8IGf6WdDbIeXkX4xoX6g sYnU+9upX4puXMqpn7KHOBhazE5SOMegbvCWMEr1/KJWbDHrDSJ+ZYWTaDiruCmkitBj gjBKapCDQuVv+unB/DfEzFrmDZRhOK+T3aJd7+SVEUuQEXA19CQvfXAufWAz24POMgS3 YNZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=mXXNt/v6uxqQdvlxYiySmlwr/vu+nlBwnj/Smuwtzqc=; b=VRV5xIiSVKwmxns+wUhiqW9o+ZPZtOIrmD5lVE0TjhDKgn8AzmlqigIcZ2tM242DhJ bJaPdIwdS62D3cBI0a1PYPRrSitd98SWI+tYSCvWWC6UyVrCPDfU+1wPNL8mdE6lOFWr 695o/govmNSlffOZpVef+yLHw1Ry/eK8hdUUayxk7bh6SjeVdS7J9SEo2NYKGZbGjhyW QslEAOR3tY4fNNBczVXA1yzImLwWbNkt/hIAiSoc7X/D0DCeVgWL+agA3n8x9tGlNBQk TTIJN99Z2jdKFzmsphw7LVrpEaeCR9olHBulqP5HA3oZnLjigg6lCHsBDUzSgOEUMmE5 P6gg== X-Gm-Message-State: AOAM532MEdkavzEkM2+0nUZCs7LrWm8YMRBr9URSokMU6NbXzBJCZcWi zy3zzzI37xH/dniKW71GnR8Zrt7mXwr3fVK+ X-Google-Smtp-Source: ABdhPJwl1V/RHDRO6h6BKEWYm4fKUX/L2azgIWRPM2uqtfv4idWQb3bwP+w1MuANEjcmIFZfwhw99g== X-Received: by 2002:a05:6512:96e:b0:448:4bd7:fff7 with SMTP id v14-20020a056512096e00b004484bd7fff7mr7093098lft.605.1647030291625; Fri, 11 Mar 2022 12:24:51 -0800 (PST) Received: from localhost.localdomain (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id y23-20020ac24477000000b00445bbae3d96sm1799570lfl.177.2022.03.11.12.24.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 12:24:51 -0800 (PST) From: =?UTF-8?q?Martin=20Storsj=C3=B6?= 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 Message-Id: <20220311202450.1760034-1-martin@martin.st> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Mar 2022 20:24:58 -0000 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