[PATCH] arc/bfd: Fix segfault from debug code, and disable debug by default

Nick Clifton nickc@redhat.com
Fri Jul 15 10:59:00 GMT 2016


Hi Cupertino,

> Thank you for the patch, however neither me or Claudiu agree with
> reverting the overflow information printing.
> Overflow information printing is a basic need for the user to identify
> linking/compiling problems.

True - but the way that it was being done was not really the "binutils way".

> Until now we were unable to tight this up. Unfortunately, we have other
> more important issues/problems to fix.
> Nevertheless, your free to improve it and contribute. ;-)

Fortunately I do have some time, so I am going to check in the attached patch.
It is based upon the one submitted by Andrew, but extended slightly. 

It tightens up the debug printing so that:

  * It is off by default.  Uncomment /* #define ARC_ENABLE_DEBUG 1  */ to use it.
    By default, users (ie non-developers) should not have debug information inflicted upon them.
    Note - since this is debugging information, there is no need for translation.

  * It compiles without errors when debugging is enabled.
    It also fixed a seg-fault when the code tried to print out some
    non-existing information.

  * There is only one debug printing macro - ARC_DEBUG, rather than two.

  * When a reloc fails to be processed, for any reason including overflow,
    an error message is printed for the user.  If debugging has been enabled
    then a very verbose error message is printed.

Whilst testing the patch I also came across a problem with the arceb-elf 
configuration - it was selecting the little endian bfd vector by default.  
So I fixed that, and a linker testcase that always assumes a little endian
arc target.

Cheers
  Nick

bfd/ChangeLog
2016-07-15  Andrew Burgess  <andrew.burgess@embecosm.com>
	    Nick Clifton  <nickc@redhat.com>

	* elf32-arc.c (PR_DEBUG): Delete.
	Fix printing of debug information.  Fix formatting of debug
	statements.
	(debug_arc_reloc): Handle symbols that are not from an input file.
	(arc_do_relocation): Remove excessive exclamation points.
	(elf_arc_relocate_section): Print an informative message if the
	relocation fails, even if debugging is not enabled.
	* arc-got.h: Fix formatting.  Fix printing of debug information.
	(new_got_entry_to_list): Use xmalloc.
	* config.bfd: use the big-endian arc vector as the default vector
	for big-endian arc targets.

ld/ChangeLog
2016-07-15  Nick Clifton  <nickc@redhat.com>

	* testsuite/ld-arc/arc.exp: Always run the sda-relocs test in
	little endian mode.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arc-debug-messages.patch
Type: text/x-patch
Size: 28810 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20160715/c9e1b5de/attachment.bin>


More information about the Binutils mailing list