This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

try adding it to the command line


This is a fix for the complaint in
http://sourceware.org/bugzilla/show_bug.cgi?id=15126#c14
about the current ld error issued for dependent libs found to satisfy
references.

The current confusing error says something like

/usr/bin/ld: myobj.o: undefined reference to symbol 'libsym'
/usr/bin/ld: note: 'libsym' is defined in DSO libdependentlib.so so
try adding it to the linker command line
libdependentlib.so: could not read symbols: Invalid operation

Now becomes

/usr/bin/ld: myobj.o: undefined reference to symbol 'libsym'
libdependentlib.so: error adding symbols: DSO missing from command line

bfd/
	* bfd.c (bfd_error_type, bfd_errmsgs): Add bfd_error_missing_dso.
	* bfd-in2.h: Regenerate.
	* elflink.c (elf_link_add_object_symbols): Use new error.
ld/
	* ldlang.c (load_symbols): Report "error adding symbols" on
	bfd_link_add_symbols failure.
	* emultempl/elf32.em (gld${EMULATION_NAME}_try_needed): Likewise.
	* emultempl/sunos.em (gld${EMULATION_NAME}_after_open): Likewise.
	(gld${EMULATION_NAME}_try_needed): Likewise.

Index: bfd/bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.124
diff -u -p -r1.124 bfd.c
--- bfd/bfd.c	21 Feb 2013 02:29:08 -0000	1.124
+++ bfd/bfd.c	4 Apr 2013 14:11:52 -0000
@@ -374,6 +374,7 @@ CODE_FRAGMENT
 .  bfd_error_no_armap,
 .  bfd_error_no_more_archived_files,
 .  bfd_error_malformed_archive,
+.  bfd_error_missing_dso,
 .  bfd_error_file_not_recognized,
 .  bfd_error_file_ambiguously_recognized,
 .  bfd_error_no_contents,
@@ -406,6 +407,7 @@ const char *const bfd_errmsgs[] =
   N_("Archive has no index; run ranlib to add one"),
   N_("No more archived files"),
   N_("Malformed archive"),
+  N_("DSO missing from command line"),
   N_("File format not recognized"),
   N_("File format is ambiguous"),
   N_("Section has no contents"),
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.485
diff -u -p -r1.485 elflink.c
--- bfd/elflink.c	27 Mar 2013 13:37:50 -0000	1.485
+++ bfd/elflink.c	4 Apr 2013 14:11:52 -0000
@@ -4443,11 +4443,7 @@ error_free_dyn:
 		  (*_bfd_error_handler)
 		    (_("%B: undefined reference to symbol '%s'"),
 		     old_bfd, name);
-		  (*_bfd_error_handler)
-		    (_("note: '%s' is defined in DSO %B"
-		       " so try adding it to the linker command line"),
-		     abfd, name);
-		  bfd_set_error (bfd_error_invalid_operation);
+		  bfd_set_error (bfd_error_missing_dso);
 		  goto error_free_vers;
 		}
 
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.405
diff -u -p -r1.405 ldlang.c
--- ld/ldlang.c	5 Mar 2013 02:55:24 -0000	1.405
+++ ld/ldlang.c	4 Apr 2013 13:53:05 -0000
@@ -2781,7 +2781,7 @@ load_symbols (lang_input_statement_type 
 		 substitute BFD for us.  */
 	      if (!bfd_link_add_symbols (subsbfd, &link_info))
 		{
-		  einfo (_("%F%B: could not read symbols: %E\n"), member);
+		  einfo (_("%F%B: error adding symbols: %E\n"), member);
 		  loaded = FALSE;
 		}
 	    }
@@ -2795,7 +2795,7 @@ load_symbols (lang_input_statement_type 
   if (bfd_link_add_symbols (entry->the_bfd, &link_info))
     entry->flags.loaded = TRUE;
   else
-    einfo (_("%F%B: could not read symbols: %E\n"), entry->the_bfd);
+    einfo (_("%F%B: error adding symbols: %E\n"), entry->the_bfd);
 
   return entry->flags.loaded;
 }
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.241
diff -u -p -r1.241 elf32.em
--- ld/emultempl/elf32.em	21 Feb 2013 04:35:22 -0000	1.241
+++ ld/emultempl/elf32.em	4 Apr 2013 08:46:07 -0000
@@ -447,7 +447,7 @@ fragment <<EOF
 
   /* Add this file into the symbol table.  */
   if (! bfd_link_add_symbols (abfd, &link_info))
-    einfo ("%F%B: could not read symbols: %E\n", abfd);
+    einfo ("%F%B: error adding symbols: %E\n", abfd);
 
   return TRUE;
 }
Index: ld/emultempl/sunos.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/sunos.em,v
retrieving revision 1.34
diff -u -p -r1.34 sunos.em
--- ld/emultempl/sunos.em	5 Mar 2012 22:43:40 -0000	1.34
+++ ld/emultempl/sunos.em	4 Apr 2013 08:46:07 -0000
@@ -429,7 +429,7 @@ gld${EMULATION_NAME}_after_open (void)
 	    {
 	      /* We've found the needed dynamic object.  */
 	      if (! bfd_link_add_symbols (abfd, &link_info))
-		einfo ("%F%B: could not read symbols: %E\n", abfd);
+		einfo ("%F%B: error adding symbols: %E\n", abfd);
 	    }
 	  else
 	    {
@@ -576,7 +576,7 @@ gld${EMULATION_NAME}_try_needed (const c
 
   /* Add this file into the symbol table.  */
   if (! bfd_link_add_symbols (abfd, &link_info))
-    einfo ("%F%B: could not read symbols: %E\n", abfd);
+    einfo ("%F%B: error adding symbols: %E\n", abfd);
 
   return TRUE;
 }

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]