Sort the .note.ABI-tag section always to the front of a binary.
authorSimon Schubert <corecode@dragonflybsd.org>
Tue, 6 Jan 2009 12:27:38 +0000 (13:27 +0100)
committerSimon Schubert <corecode@dragonflybsd.org>
Tue, 6 Jan 2009 12:27:38 +0000 (13:27 +0100)
commitd9f47b9b82dc9e762119fd00267eef9a0268680a
tree42d83b390f9d2c305e1a593849926598baccd076
parentc75ceda3a3fe7a9bc5f8f9a5ba9cfb726afc1c9f
Sort the .note.ABI-tag section always to the front of a binary.

Our kernel uses a special note section in the elf header to determine
which ABI emulation to use.  However the kernel code expects this
section to reside in the first page of a binary.
Up to now, we were just lucky to get most of our binaries linked in a
way so that the note section by chance wound up in the first page.
Yet, this was never guaranteed to happen.

Recent changes to the static library build pushed the note section
after the first page (3rd order effect), so that the kernel could not
determine the correct ABI emulation anymore.

There are two possible fixes:
For one, the kernel could be changed to accept note sections located
anywhere in the binary.  This however does not apply to already deployed
systems, which could face problems when upgrading.

Second, we could ensure that the note tag always winds up in the first
page of a binary.  We take this approach by changing our linker scripts
to sort the .note.ABI-tag section to the front.
contrib/binutils-2.17/ld/emulparams/sort-sections.sh [new file with mode: 0644]
gnu/usr.bin/binutils217/ld/Makefile.amd64
gnu/usr.bin/binutils217/ld/Makefile.i386