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: Help with linker script to relocate a .note section


>>>>> "Alan" == Alan Modra <amodra@bigpond.net.au> writes:

 Alan> On Thu, Jan 03, 2008 at 11:44:22PM -0700, Tim Rightnour wrote:
 >>  I am trying to write a linker script that will move a .note
 >> section of my elf32-powerpc binary to the head of the file,
 >> directly after the ELF headers.  Currently, what I have is this:
 >> 
 >> [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 1] .note NOTE
 >> 00000074 01d278 00002c 00 0 0 4 [ 2] .text PROGBITS 00040000
 >> 000080 00b7ec 00 WAX 0 0 16
 >> 
 >> I want the offset of the .note section to be directly after the
 >> headers, so probably at 0x80 like the .text section is, thus
 >> moving the .text section down further in the output file.

 Alan> You can't do this, unless you make a loadable note section.
 Alan> All load, alloc sections get placed first in the file, then
 Alan> non-loaded sections.

I remember I had this work once early on (but at that time the linker
had a bug so it would create the section but wouldn't put stuff in it,
or something like that).

Having the ability to put NOTE sections up front is useful because
they can then be used to put markers in the image that are seen when
it is loaded.  That's what I needed to do.  In the end I ended up
creating a custom tool to create the NOTE section directly, rather
than relying on compiler/linker to do it.

If the restriction you mention is indended to be permanent then I
guess that tool will just live on...

      paul


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