Linker plugins should be aware of --defsym during symbol resolution

Alan Modra amodra@gmail.com
Fri Feb 16 08:23:00 GMT 2018


On Thu, Feb 15, 2018 at 02:28:05PM -0800, Cary Coutant wrote:
> > Fair enough. It was a contrived example, not based on anything I have seen
> > so far. If that violates ODR then I agree all bets are off.
> 
> BTW, Ian wrote this comment in script.cc:
> 
> // The GNU linker lets symbol assignments in the linker script
> // silently override defined symbols in object files.  We are
> // compatible.  FIXME: Should we issue a warning?
> 
> I think this is a misfeature, and the comment suggests that Ian thought so too.

FWIW, so do I, but see the following in ld/ldexp.c

		  if (!update_definedness (tree->assign.dst, h) && 0)
		    {
		      /* Symbol was already defined.  For now this error
			 is disabled because it causes failures in the ld
			 testsuite: ld-elf/var1, ld-scripts/defined5, and
			 ld-scripts/pr14962.  Some of these no doubt
			 reflect scripts used in the wild.  */
		      (*link_info.callbacks->multiple_definition)
			(&link_info, h, link_info.output_bfd,
			 expld.result.section, expld.result.value);
		    }

ld-elf/var1 and ld-scripts/pr14962 both came from real-world use by
a boot loader.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list