This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] PR ld/13621


On Tue, Jan 31, 2012 at 10:57:43AM +0100, Mark Wielaard wrote:
> On Tue, 2012-01-31 at 09:46 +1030, Alan Modra wrote:
> > As far as symbols go, the ELF spec says that st_value for (non-common)
> > symbols in relocatable object files is an offset from the beginning of
> > a section.  There is nothing to say that values should be within the
> > section bounds.
> 
> But it does also say "If a symbol's value refers to a specific location
> within a section, its section index member, st_shndx, holds an index
> into the section header table." and again when defining SHN_XINDEX it
> says "It indicates that the symbol refers to a specific location within
> a section...". So I would interpret that as saying the offset shouldn't
> be outside the section.

You do have a point.  I'll not throw a fit and revert rth's patch
if he still wants to commit it.  :)

You can of course easily create symbols outside of a sections.  For
example:

 .data
 .global x
x:
 .byte 2, 3, 5, 7, 11, 13, 17, 19, 23
 .global y
y = x - '1'

But, yeah, I can't think of a really good reason why you would want to
do this.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]