Subject: .note.netbsd.ident section generating two phdrs
To: None <tech-toolchain@NetBSD.org>
From: Martin Husemann <martin@duskware.de>
List: tech-toolchain
Date: 12/05/2006 16:07:08
Christos recently enabled marking the kernel with the .note.netbsd.ident
section. For reasons that I do not understand this generates two PHDRs
(IMHO eroneously):

# obdump -p /netbsd
...
     LOAD off    0x00436278 vaddr 0xc0568278 paddr 0xc0568278 align 2**12
          filesz 0x00000018 memsz 0x00000018 flags r--
     NOTE off    0x00436278 vaddr 0xc0568278 paddr 0xc0568278 align 2**2
          filesz 0x00000018 memsz 0x00000018 flags r--

This causes scripts which use SIZEOF_HEADERS to break :-(
If I rewrite a script to explicitly put the .note into a PT_NOTE section
I get a bfd warning:

BFD: netbsd: warning: allocated section `.note.netbsd.ident' not in segment

(but the output looks fine)

Any ideas? Generic ld bug?

Martin