LD script: global symbols and multiple defintions
Ted Carter
tcarter@broadcom.com
Thu Dec 18 22:53:00 GMT 2014
Thanks for checking the code. Okay, so it sounds like a "feature" at this point.
Regards, Ted.
-----Original Message-----
From: Alan Modra [mailto:amodra@gmail.com]
Sent: Thursday, December 18, 2014 2:33 PM
To: Ted Carter
Cc: binutils@sourceware.org
Subject: Re: LD script: global symbols and multiple defintions
On Thu, Dec 18, 2014 at 05:24:04PM +0000, Ted Carter wrote:
> No, not using PROVIDE since the symbol would use the definition from the program. I'm interested in what should happen when linker script variables conflict with symbols in the program. The only reference in the ld docs I could find on this topic was the example in PROVIDE. From the example:
>
> SECTIONS
> {
> .text :
> {
> *(.text)
> _etext = .;
> PROVIDE(etext = .);
> }
> }
>
> "In this example, if the program defines `_etext' (with a leading underscore), the linker will give a multiple definition error."
Ah, sorry, I was being a little dense.
> If I replace _etext with foo and link with an object file that defines foo, like in my snippet, shouldn't I get an error?
According to the documentation, I guess so. The source however has
this:
/* FIXME: Should we worry if the symbol is already
defined? */
It's been that way for a long time.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list