Help with linker script to relocate a .note section

Tim Rightnour
Sat Jan 5 15:53:00 GMT 2008

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.

However, I have not been able to figure out what to put in the ld script to
make it do that.  I can move the note around in the section headers, but not
it's physical location in the resulting binary.

I am using GNU ld version 2.16.1 on NetBSD 4.0.

The linker script I have attempted to write is at
My ld command line (truncated) is:

ld -s -N -T /tmp/lds -Ttext 40000 -Bstatic -e _start -o output foo.o bar.o

Any advice or assistance at all would be greatly appreciated.

Tim Rightnour <>
NetBSD: Free multi-architecture OS
Genecys: Open Source 3D MMORPG:

More information about the Binutils mailing list