ld: Report error reason when a libary cannot be found

Message ID 20210727190532.210447-1-hjl.tools@gmail.com
State New
Headers show
Series
  • ld: Report error reason when a libary cannot be found
Related show

Commit Message

Cooper Qu via Binutils July 27, 2021, 7:05 p.m.
With "ulimit -n 20", report:

ld: cannot find -lgcc: Too many open files

instead of

ld: cannot find -lgcc

	* ldfile.c (ldfile_open_file): Rport error reason when a libary
	cannot be found
---
 ld/ldfile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.31.1

Comments

Cooper Qu via Binutils July 28, 2021, 5:52 a.m. | #1
On Tue, Jul 27, 2021 at 12:05:32PM -0700, H.J. Lu via Binutils wrote:
> 	* ldfile.c (ldfile_open_file): Rport error reason when a libary

> 	cannot be found


s/libary/library/

Good idea.

-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/ld/ldfile.c b/ld/ldfile.c
index 9d0af06f1f6..43b1116b1d5 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -491,11 +491,11 @@  ldfile_open_file (lang_input_statement_type *entry)
 		}
 	      else /* We ignore the return status of the script
 		      and always print the error message.  */
-		einfo (_("%P: cannot find %s\n"), entry->local_sym_name);
+		einfo (_("%P: cannot find %s: %E\n"), entry->local_sym_name);
 	    }
 #endif
 	  else
-	    einfo (_("%P: cannot find %s\n"), entry->local_sym_name);
+	    einfo (_("%P: cannot find %s: %E\n"), entry->local_sym_name);
 
 	  /* PR 25747: Be kind to users who forgot to add the
 	     "lib" prefix to their library when it was created.  */