This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: GNU LD: Linker script generating incorrect address
- From: Alan Modra <amodra at gmail dot com>
- To: Jens Bauer <jens-lists at gpio dot dk>
- Cc: binutils at sourceware dot org
- Date: Tue, 21 May 2013 18:17:20 +0930
- Subject: Re: GNU LD: Linker script generating incorrect address
- References: <20130521062602780057 dot 62ec95fc at gpio dot dk> <20130521053016 dot GE9651 at bubble dot grove dot modra dot org> <20130521100851904201 dot d72777f3 at gpio dot dk>
On Tue, May 21, 2013 at 10:08:51AM +0200, Jens Bauer wrote:
> I've read these (online):
> <http://sourceware.org/binutils/docs/ld/index.html#Top>
> (<http://sourceware.org/binutils/docs-2.23.1/ld/index.html>)
> <http://info2html.sourceforge.net/cgi-bin/info2html-demo/info2html?(ld.info.gz)Expressions>
> -Are those the ones the same as the "ld info doc" ?
Yes.
> ($info ld does not give anything useful at my end)
Some distros don't install documentation unless you install
"development" packages. It would of course be a good idea to read the
docs for your particular binutils.
> If they are, I've read the section about linker scripts 4 times now and still haven't come across any place explaining what not to do, regarding symbols.
It's not so much what not to do, but knowing that symbols can be
absolute or section relative.
http://sourceware.org/binutils/docs/ld/Expression-Section.html#Expression-Section
has some examples and goes into some detail on how ld evaluates
expressions. Unfortunately the rules are not simple, mainly due to
wanting some level of backwards compatibility with older versions of
ld.
--
Alan Modra
Australia Development Lab, IBM