[PATCH] Allow different values than ELFOSABI_SYSV for ELF OSABI

Robert Millan rmh at aybabtu.com
Sat Feb 4 13:17:56 UTC 2006


>From libc-alpha:

On Fri, Feb 03, 2006 at 03:47:52PM -0800, Roland McGrath wrote:
> Every glibc configuration should accept DSOs with the standard header
> format, which means ELFOSABI_SYSV.  If your configuration wants to accept
> others too, then you should follow the example of the arm and hppa ports,
> which already do this:
> 
> #define VALID_ELF_ABIVERSION(ver)	(ver == 0)
> #define VALID_ELF_OSABI(osabi) \
>   (osabi == ELFOSABI_SYSV || osabi == ELFOSABI_ARM)
> #define VALID_ELF_HEADER(hdr,exp,size) \
>   memcmp (hdr,exp,size-2) == 0 \
>   && VALID_ELF_OSABI (hdr[EI_OSABI]) \
>   && VALID_ELF_ABIVERSION (hdr[EI_ABIVERSION])

This translates into:

Index: sysdeps/kfreebsd/dl-machine.h
===================================================================
--- sysdeps/kfreebsd/dl-machine.h       (revision 1109)
+++ sysdeps/kfreebsd/dl-machine.h       (working copy)
@@ -21,6 +21,11 @@
 /* Contrary to most kernels which use ELFOSABI_SYSV aka ELFOSABI_NONE,
    FreeBSD uses ELFOSABI_FREEBSD for the OSABI field. */

-#define ELF_OSABI ELFOSABI_FREEBSD
+#define VALID_ELF_OSABI(osabi)         ((osabi == ELFOSABI_SYSV) || (osabi == ELFOSABI_FREEBSD))

+/* Copied from elf/dl-load.c */
+
+#define VALID_ELF_HEADER(hdr,exp,size) (memcmp (hdr, exp, size) == 0)
+#define VALID_ELF_ABIVERSION(ver)      (ver == 0)
+
 #include_next "dl-machine.h"

however if we want to get rid of the rejected patch (fixes/elfosabi.patch), we'd
have to assume ELFOSABI_SYSV will be the default.  I think there was a patch
around to make the kernel accept that?  I had a look at the source but I couldn't
figure it out.

-- 
Robert Millan



More information about the Glibc-bsd-devel mailing list