public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] dlltool: Allow inferring tmp_prefix from the dll name from a def file
@ 2022-01-11 20:36 Martin Storsjö
  2022-01-18 21:55 ` Martin Storsjö
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Storsjö @ 2022-01-11 20:36 UTC (permalink / raw)
  To: binutils

Move the initialization of tmp_prefix slightly later in the process,
which should allow inferring a deterministic tmp_prefix from the
dll name read from a def file, not only from the -D option.

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 binutils/dlltool.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index a1e2b484328..d95bf3f5470 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -3930,23 +3930,6 @@ main (int ac, char **av)
 	}
     }
 
-  if (tmp_prefix == NULL)
-    {
-      /* If possible use a deterministic prefix.  */
-      if (dll_name)
-        {
-          tmp_prefix = xmalloc (strlen (dll_name) + 2);
-          sprintf (tmp_prefix, "%s_", dll_name);
-          for (i = 0; tmp_prefix[i]; i++)
-            if (!ISALNUM (tmp_prefix[i]))
-              tmp_prefix[i] = '_';
-        }
-      else
-        {
-          tmp_prefix = prefix_encode ("d", getpid ());
-        }
-    }
-
   for (i = 0; mtable[i].type; i++)
     if (strcmp (mtable[i].type, mname) == 0)
       break;
@@ -4006,6 +3989,23 @@ main (int ac, char **av)
       optind++;
     }
 
+  if (tmp_prefix == NULL)
+    {
+      /* If possible use a deterministic prefix.  */
+      if (dll_name)
+        {
+          tmp_prefix = xmalloc (strlen (dll_name) + 2);
+          sprintf (tmp_prefix, "%s_", dll_name);
+          for (i = 0; tmp_prefix[i]; i++)
+            if (!ISALNUM (tmp_prefix[i]))
+              tmp_prefix[i] = '_';
+        }
+      else
+        {
+          tmp_prefix = prefix_encode ("d", getpid ());
+        }
+    }
+
   mangle_defs ();
 
   if (exp_name)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dlltool: Allow inferring tmp_prefix from the dll name from a def file
  2022-01-11 20:36 [PATCH] dlltool: Allow inferring tmp_prefix from the dll name from a def file Martin Storsjö
@ 2022-01-18 21:55 ` Martin Storsjö
  2022-01-22 14:33   ` Nick Clifton
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Storsjö @ 2022-01-18 21:55 UTC (permalink / raw)
  To: binutils

On Tue, 11 Jan 2022, Martin Storsjö wrote:

> Move the initialization of tmp_prefix slightly later in the process,
> which should allow inferring a deterministic tmp_prefix from the
> dll name read from a def file, not only from the -D option.
>
> Signed-off-by: Martin Storsjö <martin@martin.st>
> ---
> binutils/dlltool.c | 34 +++++++++++++++++-----------------
> 1 file changed, 17 insertions(+), 17 deletions(-)

Ping

// Martin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dlltool: Allow inferring tmp_prefix from the dll name from a def file
  2022-01-18 21:55 ` Martin Storsjö
@ 2022-01-22 14:33   ` Nick Clifton
  2022-01-23  1:20     ` Allan McRae
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Clifton @ 2022-01-22 14:33 UTC (permalink / raw)
  To: Martin Storsjö, binutils

Hi Martin,

>> Move the initialization of tmp_prefix slightly later in the process,
>> which should allow inferring a deterministic tmp_prefix from the
>> dll name read from a def file, not only from the -D option.

> Ping

Sorry - overworked as usual.

The patch is fine.  I have gone ahead and applied to the mainline and 2.38 branch.

Cheers
   Nick



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dlltool: Allow inferring tmp_prefix from the dll name from a def file
  2022-01-22 14:33   ` Nick Clifton
@ 2022-01-23  1:20     ` Allan McRae
  2022-01-23  1:29       ` Allan McRae
  0 siblings, 1 reply; 6+ messages in thread
From: Allan McRae @ 2022-01-23  1:20 UTC (permalink / raw)
  To: Nick Clifton, Martin Storsjö, binutils

On 23/1/22 00:33, Nick Clifton via Binutils wrote:
> Hi Martin,
> 
>>> Move the initialization of tmp_prefix slightly later in the process,
>>> which should allow inferring a deterministic tmp_prefix from the
>>> dll name read from a def file, not only from the -D option.
> 
>> Ping
> 
> Sorry - overworked as usual.
> 
> The patch is fine.  I have gone ahead and applied to the mainline and 
> 2.38 branch.
> 
> Cheers
>    Nick
> 

Since this patch I get allocfail.so failing:

$ cat ./libbacktrace/allocfail.sh.log
/build/binutils/src/binutils-gdb/libbacktrace/../test-driver: line 107: 
/build/binutils/src/binutils-gdb/libbacktrace/allocfail.sh: No such file 
or directory
FAIL allocfail.sh (exit status: 127)

And libbacktrace/Makefile is empty below:

allocfail.sh: allocfail


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dlltool: Allow inferring tmp_prefix from the dll name from a def file
  2022-01-23  1:20     ` Allan McRae
@ 2022-01-23  1:29       ` Allan McRae
  2022-01-24 14:01         ` Nick Clifton
  0 siblings, 1 reply; 6+ messages in thread
From: Allan McRae @ 2022-01-23  1:29 UTC (permalink / raw)
  To: Nick Clifton, Martin Storsjö, binutils

On 23/1/22 11:20, Allan McRae via Binutils wrote:
> On 23/1/22 00:33, Nick Clifton via Binutils wrote:
>> Hi Martin,
>>
>>>> Move the initialization of tmp_prefix slightly later in the process,
>>>> which should allow inferring a deterministic tmp_prefix from the
>>>> dll name read from a def file, not only from the -D option.
>>
>>> Ping
>>
>> Sorry - overworked as usual.
>>
>> The patch is fine.  I have gone ahead and applied to the mainline and 
>> 2.38 branch.
>>
>> Cheers
>>    Nick
>>
> 
> Since this patch I get allocfail.so failing:
> 
> $ cat ./libbacktrace/allocfail.sh.log
> /build/binutils/src/binutils-gdb/libbacktrace/../test-driver: line 107: 
> /build/binutils/src/binutils-gdb/libbacktrace/allocfail.sh: No such file 
> or directory
> FAIL allocfail.sh (exit status: 127)
> 
> And libbacktrace/Makefile is empty below:
> 
> allocfail.sh: allocfail
> 

It looks like allocfail.sh was accidentally deleted when applying this 
patch to the binutils 2.38 branch.

Allan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dlltool: Allow inferring tmp_prefix from the dll name from a def file
  2022-01-23  1:29       ` Allan McRae
@ 2022-01-24 14:01         ` Nick Clifton
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Clifton @ 2022-01-24 14:01 UTC (permalink / raw)
  To: Allan McRae, Martin Storsjö, binutils

Hi Allan,

> It looks like allocfail.sh was accidentally deleted when applying this patch to the binutils 2.38 branch.

Weird.  I have no idea how that happened.

Thanks for reporting the issue - I have now reimported the file into the 2.38 branch.

Cheers
   Nick



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-24 14:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 20:36 [PATCH] dlltool: Allow inferring tmp_prefix from the dll name from a def file Martin Storsjö
2022-01-18 21:55 ` Martin Storsjö
2022-01-22 14:33   ` Nick Clifton
2022-01-23  1:20     ` Allan McRae
2022-01-23  1:29       ` Allan McRae
2022-01-24 14:01         ` Nick Clifton

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).