public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* limit overflow errors to something sensible
@ 2003-04-11  1:47 Alexandre Oliva
  2003-05-04 21:25 ` Alexandre Oliva
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Oliva @ 2003-04-11  1:47 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 334 bytes --]

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ld-overflow-cutoff.patch --]
[-- Type: text/x-patch, Size: 2781 bytes --]

Index: ld/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.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);

[-- Attachment #3: Type: text/plain, Size: 289 bytes --]


-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: limit overflow errors to something sensible
  2003-04-11  1:47 limit overflow errors to something sensible Alexandre Oliva
@ 2003-05-04 21:25 ` Alexandre Oliva
  2003-05-05  5:22   ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Oliva @ 2003-05-04 21:25 UTC (permalink / raw)
  To: binutils

On Apr 10, 2003, Alexandre Oliva <aoliva@redhat.com> wrote:

> Index: ld/ChangeLog
> from  Alexandre Oliva  <aoliva@redhat.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.

Ping?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: limit overflow errors to something sensible
  2003-05-04 21:25 ` Alexandre Oliva
@ 2003-05-05  5:22   ` Alan Modra
  2003-05-07  4:13     ` Alexandre Oliva
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Modra @ 2003-05-05  5:22 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: binutils

On Sun, May 04, 2003 at 06:25:50PM -0300, Alexandre Oliva wrote:
> On Apr 10, 2003, Alexandre Oliva <aoliva@redhat.com> wrote:
> 
> > Index: ld/ChangeLog
> > from  Alexandre Oliva  <aoliva@redhat.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.
> 
> Ping?

OK, except the overflow_cutoff_limit comment needs fixing to agree
with the code (-2 => no limit, not -1).

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: limit overflow errors to something sensible
  2003-05-05  5:22   ` Alan Modra
@ 2003-05-07  4:13     ` Alexandre Oliva
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2003-05-07  4:13 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

On May  5, 2003, Alan Modra <amodra@bigpond.net.au> wrote:

> On Sun, May 04, 2003 at 06:25:50PM -0300, Alexandre Oliva wrote:
>> On Apr 10, 2003, Alexandre Oliva <aoliva@redhat.com> wrote:
>> 
>> > Index: ld/ChangeLog
>> > from  Alexandre Oliva  <aoliva@redhat.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.
>> 
>> Ping?

> OK, except the overflow_cutoff_limit comment needs fixing to agree
> with the code (-2 => no limit, not -1).

The comment says -1 is for no errors, and less than that for no
limits, so it's already correct.  I'm going ahead and checking it in.
Thanks,

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-05-07  4:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-11  1:47 limit overflow errors to something sensible Alexandre Oliva
2003-05-04 21:25 ` Alexandre Oliva
2003-05-05  5:22   ` Alan Modra
2003-05-07  4:13     ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).