Subject: Re: kern/13615: NetBSD current requires a .note.netbsd.ident
To: None <>
From: None <>
List: netbsd-bugs
Date: 08/03/2001 09:22:14
[ i've trimmed most of the cc:s ]

So, to hit one or two points that I don't think anybody has quite
gotten: writes:
> Unfortunatly, unbundled complers (eg GCC>3.0) typically don't use system supplied files such as crtbegin.o - instead they supply their own.  Consequently, an unbundled compiler won't include the crtbegin.o .note section and, in turn, won't be able to generate binaries that can be run on NetBSD-current.

It's quite reasonable to say: "If those unbundled tools do not
generate the ELF notes, then those unbundled tools do not generate
programs which conform to the NetBSD ABI."  8-)

(btw, to be clear, the .note section is -- or should be irrelevant.
What's relevant is the PT_NOTE.)

This stuff is actually documented, see:

It has been documented in that location since September 1998, and
documented at a previous location in the web pages since June 1997.
Pointers to those URLs have been published in various places at
various points in the past.

There's even documentation there on how to create such tags with
modern binutils, and it looks approximately correct, so it's really
not our fault.  8-)

By the way, for people who say that Linux binaries aren't marked:

The documentation about the linux ABI tags seems to be out of date (at
least, looking at a recent linux mips binary), but indeed if using a
modern glibc and modern tools linux binaries _do_ seem to be marked
with an ELF note that basically follows the description outlined

There's extra stuff in "Desc" and length is longer to make up for it,
but e.g. 'Type' is 1 as expected and 'Name' seems to be 'GNU\0'.

So, in a nutshell, my opinion about this whole thing is:

(1) all new NetBSD binaries to be run natively must include ELF notes.
It's there, it's documented, it's been there and documented for years,

(2) for the case of compatibility with old NetBSD binaries, I'd say:

	(a) it should be configurable at run-time via sysctl, and

	(b) it should default to 'off' with documentation where
	appropriate to remind people to change it, and a way to change
	the default in the kernel binary and kernel build (i.e.,
	patchable option-settable kernel variable).

IIRC MIPS is the only port which has pre-note binaries...  And there
are bigger bits of pain coming down for old MIPS binaries.  (there's
an incompatible ABI change in the latest binutils w.r.t. some relocs
used in dynamic linking, which breaks existing NetBSD code/binaries.)

I'll see about updating the web page to match present reality,
w.r.t. the GNU ELF notes.