gold patch committed: Better error message locations

Ian Lance Taylor iant@google.com
Mon Apr 18 05:40:00 GMT 2011


The test that gold printed for an error message location was overly
verbose.  This patch changes it.  Now if there is file/lineno available,
we just print that.  Otherwise we print the object name, and either
filename/function or section+offset.  In all cases we omit the program
name.

Without debug info:

Old gold:

gold/ld-new: foo2.o: in function main:foo2.cc(.text+0x5): error: undefined reference to 'bar()'
gold/ld-new: foo2.o:(.eh_frame+0x12): error: undefined reference to '__gxx_personality_v0'

New gold:

foo2.o:foo2.cc:function main: error: undefined reference to 'bar()'
foo2.o(.eh_frame+0x12): error: undefined reference to '__gxx_personality_v0'

GNU ld:

foo2.o: In function `main':
foo2.cc:(.text+0x5): undefined reference to `bar()'
foo2.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'



With debug info:

Old gold:

gold/ld-new: foo2.o: in function main:/home/iant/foo2.cc:3: error: undefined reference to 'bar()'
gold/ld-new: foo2.o:(.eh_frame+0x12): error: undefined reference to '__gxx_personality_v0'

New gold:

/home/iant/foo2.cc:3: error: undefined reference to 'bar()'
foo2.o(.eh_frame+0x12): error: undefined reference to '__gxx_personality_v0'

GNU ld:

foo2.o: In function `main':
/home/iant/foo2.cc:3: undefined reference to `bar()'
foo2.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'


Committed to mainline.

Ian


2011-04-17  Ian Lance Taylor  <iant@google.com>

	* object.cc (Relocate_info::location): Simplify location string.
	* errors.cc (Errors::error_at_location): Don't print program
	name.
	(Errors::warning_at_location): Likewise.
	(Errors::undefined_symbol): Likewise.
	* testsuite/debug_msg.sh: Update accordingly.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 8592 bytes
Desc: patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20110418/cb178e8a/attachment.bin>


More information about the Binutils mailing list