bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ld: can't put data into PHDR types other than PT_LOAD


From: Ian Lance Taylor
Subject: Re: ld: can't put data into PHDR types other than PT_LOAD
Date: 30 Nov 2004 14:18:37 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Paul Koning <address@hidden> writes:

> It seems pretty pointless to have PHDRS if you can't put any data into
> them, but it appears that this is how they work.  Only PT_LOAD
> sections seem to accept data.
> 
> If you do try to put stuff into, say, a PT_NOTE section, you get a
> linker warning.  You also get a rather bizarre combination of values
> in the headers, which suggest that the linker tried to put some data
> into the PT_NOTE header but decided against it at the last minute.
> Specifically, you get the expected length (not zero) but you don't get
> the load address filled in.
> 
> I can work around this by dropping the data in question into two
> PHDRs, but surely this isn't right?

No, actually it is right.

Allocated data is data which should be accessible at run time.  The
only segments which the dynamic linker will load into memory are
PT_LOAD segments.  Therefore, all allocated data must go into a
PT_LOAD segment.  That is why the linker is warning you.

Presumably you do want the data to be accessible at run time (a
PT_NOTE segment can be either--it is entirely reasonable to have
PT_NOTE segments which are not loaded, if they are only read by tools
and not by the program itself).  For a runtime-accessible note
section, the section should be in both a PT_LOAD segment and a PT_NOTE
segment; the PT_NOTE segment would typically be a subset of the
PT_LOAD segment.

Ian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]