[binutils-gdb] dlltool: Use the output name as basis for deterministic temp prefixes

Nick Clifton nickc@sourceware.org
Wed Mar 16 15:22:11 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d65c0ddddd85645cab6f11fd711d21638a74489f

commit d65c0ddddd85645cab6f11fd711d21638a74489f
Author: Martin Storsj? <martin@martin.st>
Date:   Wed Mar 16 15:01:30 2022 +0000

    dlltool: Use the output name as basis for deterministic temp prefixes
    
            PR 28885
            * dlltool.c (main): use imp_name rather than dll_name when
            generating a temporary file name.

Diff:
---
 binutils/ChangeLog | 6 ++++++
 binutils/dlltool.c | 7 ++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 6d49d8c7125..127ee5c50d1 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2022-03-16  Martin Storsjö  <martin@martin.st>
+
+	PR 28885
+	* dlltool.c (main): use imp_name rather than dll_name when
+	generating a temporary file name.
+
 2022-03-16  Simon Marchi  <simon.marchi@efficios.com>
 
 	* readelf.c (dump_relocations): Handle EM_AMDGPU.
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] = '_';


More information about the Binutils-cvs mailing list