[PATCH] Provide a sample object file for each ODR-violating location

Ian Lance Taylor iant@google.com
Sun Jun 27 06:18:00 GMT 2010


Jeffrey Yasskin <jyasskin@google.com> writes:

> Right now, gold produces errors like
>
> warning: while linking my_exe: symbol 'ns::Tpl<Arg>::~Tpl()' defined
> in multiple places (possible ODR violation):
>  ./path/to/some_header.h:38
>  ./path/to/other_header.h:490
>
> While trying to figure out why this is happening, I wanted to know
> which object files those definitions came from. The attached patch
> changes the output to:
>
> warning: while linking my_exe: symbol 'ns::Tpl<Arg>::~Tpl()' defined
> in multiple places (possible ODR violation):
>  ./path/to/some_header.h:38 from libfoo.a(obj1.o)
>  ./path/to/other_header.h:490 from libfoo.a(obj2.o)
>
> where the object file after "from" is an arbitrary object file
> including that location. This may be spammy in ordinary use, but it
> should be useful while we iron out the false positives.

Thanks.  Approved and applied, with this ChangeLog entry.

2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>

	* symtab.cc (detect_odr_violations): When reporting an ODR
	violation, report an object where the symbol is defined.

Ian



More information about the Binutils mailing list