[PATCH] Allow different values than ELFOSABI_SYSV for ELF OSABI

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Allow different values than ELFOSABI_SYSV for ELF OSABI

Aurelien Jarno
Hi all,

Currently the GNU libc assumes that all binary files have the ELF OSABI
field set to ELFOSABI_SYSV aka ELFOSABI_NONE. This is a problem on a
FreeBSD kernel, as it expects files to have the OSABI field set to
ELFOSABI_FREEBSD.

Please find attached a patch that makes possible the definition of the
OSABI in sysdeps/.../dl-machine.h. Note that ELFOSABI_SYSV is still the
default value.

Thanks,
Aurelien


2006-01-22  Aurelien Jarno  <[hidden email]>

        * elf/dl-load.c: Use ELF_OSABI instead of ELFOSABI_SYSV. Default
          ELF_OSABI to ELFOSABI_SYSV.

--
  .''`.  Aurelien Jarno            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [hidden email]         | [hidden email]
   `-    people.debian.org/~aurel32 | www.aurel32.net

libc-elfosabi.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Allow different values than ELFOSABI_SYSV for ELF OSABI

Roland McGrath
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])



Thanks,
Roland
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Allow different values than ELFOSABI_SYSV for ELF OSABI

Aurelien Jarno
Roland McGrath a écrit :

> 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])

Thanks for the hint!

Aurelien

--
   .''`.  Aurelien Jarno            | GPG: 1024D/F1BCDB73
  : :' :  Debian developer           | Electrical Engineer
  `. `'   [hidden email]         | [hidden email]
    `-    people.debian.org/~aurel32 | www.aurel32.net