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]

Patch for review - 4437 "ld check all files are present and indicate those missing"


Hello

I added patch for review to  4437 "ld check all files are present and
indicate those missing". If someone has time, I'd appreciate any
feedback, or commit if happy with it please. Patch attached.

http://sourceware.org/bugzilla/show_bug.cgi?id=4437

I'm not on this list, so please include my email address in any replies.

Cheers, Jon

2010-01-19  Jon Grant <jg at jguk org>
	* ldlang.h: Add missing_file flag.
	* ldlang.c: Initialise missing_file flag to FALSE. In addition don't
try use bfd if library was missing. After checking all libraries, exit
if missing_file was set to TRUE.
	* ldfile.c: Set missing_file flag TRUE when library cannot be found.
Index: ldfile.c
===================================================================
RCS file: /cvs/src/src/ld/ldfile.c,v
retrieving revision 1.53
diff -u -r1.53 ldfile.c
--- ldfile.c	29 Aug 2009 22:11:01 -0000	1.53
+++ ldfile.c	19 Jan 2010 21:09:23 -0000
@@ -41,6 +41,7 @@
 unsigned long ldfile_output_machine;
 enum bfd_architecture ldfile_output_architecture;
 search_dirs_type * search_head;
+extern bfd_boolean missing_file;
 
 #ifdef VMS
 static char * slash = "";
@@ -409,10 +410,12 @@
       else if (entry->sysrooted
 	       && ld_sysroot
 	       && IS_ABSOLUTE_PATH (entry->local_sym_name))
-	einfo (_("%F%P: cannot find %s inside %s\n"),
+	einfo (_("%F%P: error: cannot find %s inside %s\n"),
 	       entry->local_sym_name, ld_sysroot);
       else
-	einfo (_("%F%P: cannot find %s\n"), entry->local_sym_name);
+	einfo (_("%P: error: cannot find %s\n"), entry->local_sym_name);
+	entry->missing_file = TRUE;
+	missing_file = TRUE;
     }
 }
 
Index: ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.327
diff -u -r1.327 ldlang.c
--- ldlang.c	11 Dec 2009 13:42:14 -0000	1.327
+++ ldlang.c	19 Jan 2010 21:09:24 -0000
@@ -103,6 +103,7 @@
 struct lang_nocrossrefs *nocrossref_list;
 static struct unique_sections *unique_section_list;
 static bfd_boolean ldlang_sysrooted_script = FALSE;
+bfd_boolean missing_file = FALSE;
 
  /* Functions that traverse the linker script and might evaluate
     DEFINED() need to increment this.  */
@@ -1060,6 +1061,8 @@
   p->add_DT_NEEDED_for_regular = add_DT_NEEDED_for_regular;
   p->whole_archive = whole_archive;
   p->loaded = FALSE;
+  p->missing_file = FALSE;
+
   lang_statement_append (&input_file_chain,
 			 (lang_statement_union_type *) p,
 			 &p->next_real_file);
@@ -2583,6 +2586,12 @@
 
   ldfile_open_file (entry);
 
+  /* Do not process further if the file was missing */
+  if(TRUE == entry->missing_file)
+  {
+     return TRUE;
+  }
+
   if (! bfd_check_format (entry->the_bfd, bfd_archive)
       && ! bfd_check_format_matches (entry->the_bfd, bfd_object, &matching))
     {
@@ -3164,6 +3173,12 @@
 	  break;
 	}
     }
+
+	/* Exit if any of the files were missing */
+	if(TRUE == missing_file)
+	{
+	  einfo ("%F");
+	}
 }
 
 /* Add a symbol to a hash of symbols used in DEFINED (NAME) expressions.  */
Index: ldlang.h
===================================================================
RCS file: /cvs/src/src/ld/ldlang.h,v
retrieving revision 1.87
diff -u -r1.87 ldlang.h
--- ldlang.h	5 Nov 2009 15:35:50 -0000	1.87
+++ ldlang.h	19 Jan 2010 21:09:24 -0000
@@ -279,9 +279,13 @@
   /* Whether to include the entire contents of an archive.  */
   unsigned int whole_archive : 1;
 
+  /* Set to TRUE when bfd opening is successful */
   unsigned int loaded : 1;
 
   unsigned int real : 1;
+
+  /* Set to TRUE if the file does not exist */
+  unsigned int missing_file : 1;
 } lang_input_statement_type;
 
 typedef struct

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