This is the mail archive of the binutils@sources.redhat.com 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]

limit overflow errors to something sensible


When the GOT overflows on MIPS (which is possible in spite of
multi-got, if the overflow is caused a single input object file), we
often get thousands of error messages.  This patch introduces a limit
of 10 errors that explicitly mention the overflowing relocation, plus
one in case more such errors are encountered.  Ok to install?

Index: ld/ChangeLog
from  Alexandre Oliva  <aoliva at redhat dot com>

	* ldmain.h (overflow_cutoff_limit): Declare.
	* ldmain.c (overflow_cutoff_limit): Define, initialized to 10.
	(reloc_overflow): Limit error messages based on it.
	* lexsup.c (parse_args) <OPTION_VERBOSE>: Set cutoff to
	unlimited.

Index: ld/ldmain.c
===================================================================
RCS file: /cvs/uberbaum/ld/ldmain.c,v
retrieving revision 1.66
diff -u -p -r1.66 ldmain.c
--- ld/ldmain.c 31 Mar 2003 18:12:52 -0000 1.66
+++ ld/ldmain.c 11 Apr 2003 01:37:21 -0000
@@ -1360,6 +1360,15 @@ undefined_symbol (info, name, abfd, sect
   return TRUE;
 }
 
+/* Counter to limit the number of relocation overflow error messages
+   to print.  Errors are printed as it is decremented.  When it's
+   called and the counter is zero, a final message is printed
+   indicating more relocations were omitted.  When it gets to -1, no
+   such errors are printed.  If it's initially set to a value less
+   than -1, all such errors will be printed (--verbose does this).  */
+
+int overflow_cutoff_limit = 10;
+
 /* This is called when a reloc overflows.  */
 
 static bfd_boolean
@@ -1372,10 +1381,21 @@ reloc_overflow (info, name, reloc_name, 
      asection *section;
      bfd_vma address;
 {
+  if (overflow_cutoff_limit == -1)
+    return TRUE;
+
   if (abfd == (bfd *) NULL)
     einfo (_("%P%X: generated"));
   else
     einfo ("%X%C:", abfd, section, address);
+
+  if (overflow_cutoff_limit >= 0
+      && overflow_cutoff_limit-- == 0)
+    {
+      einfo (_(" additional relocation overflows omitted from the output\n"));
+      return TRUE;
+    }
+
   einfo (_(" relocation truncated to fit: %s %T"), reloc_name, name);
   if (addend != 0)
     einfo ("+%v", addend);
Index: ld/ldmain.h
===================================================================
RCS file: /cvs/uberbaum/ld/ldmain.h,v
retrieving revision 1.5
diff -u -p -r1.5 ldmain.h
--- ld/ldmain.h 25 Mar 2003 10:29:28 -0000 1.5
+++ ld/ldmain.h 11 Apr 2003 01:37:21 -0000
@@ -36,6 +36,7 @@ extern bfd_boolean demangling;
 extern int g_switch_value;
 extern const char *output_filename;
 extern struct bfd_link_info link_info;
+extern int overflow_cutoff_limit;
 
 extern void add_ysym PARAMS ((const char *));
 extern void add_wrap PARAMS ((const char *));
Index: ld/lexsup.c
===================================================================
RCS file: /cvs/uberbaum/ld/lexsup.c,v
retrieving revision 1.61
diff -u -p -r1.61 lexsup.c
--- ld/lexsup.c 31 Mar 2003 18:12:52 -0000 1.61
+++ ld/lexsup.c 11 Apr 2003 01:37:22 -0000
@@ -1047,6 +1047,7 @@ parse_args (argc, argv)
 	  ldversion (1);
 	  version_printed = TRUE;
 	  trace_file_tries = TRUE;
+	  overflow_cutoff_limit = -2;
 	  break;
 	case 'v':
 	  ldversion (0);
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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