PR28673, input file 'gcov' is the same as output file

Alan Modra amodra@gmail.com
Wed Dec 8 10:04:24 GMT 2021


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


More information about the Binutils mailing list