dlltool: Use the output name as basis for deterministic temp prefixes
authorMartin Storsj? <martin@martin.st>
Wed, 16 Mar 2022 15:01:30 +0000 (15:01 +0000)
committerNick Clifton <nickc@redhat.com>
Wed, 16 Mar 2022 15:22:05 +0000 (15:22 +0000)
PR 28885
* dlltool.c (main): use imp_name rather than dll_name when
generating a temporary file name.

binutils/ChangeLog
binutils/dlltool.c

index 6d49d8c71258d786dae3d14878dd07e8efe421d9..127ee5c50d1d52e8be912fa37cc1c89e9e7f71cc 100644 (file)
@@ -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.
index d95bf3f5470b999fa3b30bc887791859f48d81d1..89871510b459a78ba1076368e3752c677f8daaf6 100644 (file)
@@ -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] = '_';