public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PR28673, input file 'gcov' is the same as output file
@ 2021-12-08 10:04 Alan Modra
  2021-12-08 10:17 ` Martin Liška
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2021-12-08 10:04 UTC (permalink / raw)
  To: binutils

For an input -lgcov, filename is gcov and local_sym_name is -lgcov.
Use local_sym_name so that ld -o gcov -lgcov works.

	PR 28673
	* ldlang.c (open_output): Use local_sym_name when checking
	output against input files rather than filename.

diff --git a/ld/ldlang.c b/ld/ldlang.c
index 64a8f602093..a0ff1229344 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -3400,7 +3400,7 @@ open_output (const char *name)
        f = f->next_real_file)
     if (f->flags.real)
       {
-	char *in = lrealpath (f->filename);
+	char *in = lrealpath (f->local_sym_name);
 	if (filename_cmp (in, out) == 0)
 	  einfo (_("%F%P: input file '%s' is the same as output file\n"),
 		 f->filename);

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: PR28673, input file 'gcov' is the same as output file
  2021-12-08 10:04 PR28673, input file 'gcov' is the same as output file Alan Modra
@ 2021-12-08 10:17 ` Martin Liška
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Liška @ 2021-12-08 10:17 UTC (permalink / raw)
  To: Alan Modra, binutils

On 12/8/21 11:04, Alan Modra via Binutils wrote:
> For an input -lgcov, filename is gcov and local_sym_name is -lgcov.
> Use local_sym_name so that ld -o gcov -lgcov works.
> 
> 	PR 28673
> 	* ldlang.c (open_output): Use local_sym_name when checking
> 	output against input files rather than filename.
> 
> diff --git a/ld/ldlang.c b/ld/ldlang.c
> index 64a8f602093..a0ff1229344 100644
> --- a/ld/ldlang.c
> +++ b/ld/ldlang.c
> @@ -3400,7 +3400,7 @@ open_output (const char *name)
>          f = f->next_real_file)
>       if (f->flags.real)
>         {
> -	char *in = lrealpath (f->filename);
> +	char *in = lrealpath (f->local_sym_name);
>   	if (filename_cmp (in, out) == 0)
>   	  einfo (_("%F%P: input file '%s' is the same as output file\n"),
>   		 f->filename);
> 

Thanks for the quick fix.

Martin

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

end of thread, other threads:[~2021-12-08 10:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 10:04 PR28673, input file 'gcov' is the same as output file Alan Modra
2021-12-08 10:17 ` Martin Liška

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