This is the mail archive of the
mailing list for the binutils project.
Re: LD script: global symbols and multiple defintions
- From: Alan Modra <amodra at gmail dot com>
- To: Ted Carter <tcarter at broadcom dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Fri, 19 Dec 2014 09:03:27 +1030
- Subject: Re: LD script: global symbols and multiple defintions
- Authentication-results: sourceware.org; auth=none
- References: <loom dot 20141218T002405-365 at post dot gmane dot org> <20141218065418 dot GE23483 at bubble dot grove dot modra dot org> <DF49179EB23F044CB6D2F4C93B7FABD042CF1635 at SJEXCHMB06 dot corp dot ad dot broadcom dot com>
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:
> .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
/* FIXME: Should we worry if the symbol is already
It's been that way for a long time.
Australia Development Lab, IBM