Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 22 Mar 2024 17:54:34 -0700
From: enh <enh@...gle.com>
To: libc-coord@...ts.openwall.com
Cc: Sevan Janiyan <venture37@...klan.co.uk>
Subject: Re: Elf_GNU_Hash_Header

On Fri, Mar 22, 2024 at 9:37 AM Brooks Davis <brooks@...ebsd.org> wrote:
>
> On Fri, Mar 22, 2024 at 05:08:28PM +0100, Florian Weimer wrote:
> > * Sevan Janiyan:
> >
> > > On 22/03/2024 02:52, Brooks Davis wrote:
> > >> It was added it 2009 by the author of elftoolchain which is its only
> > >> consumer AFACT.  If no one else has added I doubt there is much demand
> > >> for it and it's probably a mistake that it's in sys/elf_common.h.
> > >
> > > http://www.linker-aliens.org/blogs/ali/entry/gnu_hash_elf_sections/
> > >
> > > elftoolchain author:
> > >
> > > On 22/03/2024 13:44, Joseph Koshy wrote:
> > >>> } Elf_GNU_Hash_Header;
> > >> IIRC this is a GNU extension to the ELF file format that we started
> > >> supporting in 2009:
> > >>
> > >> https://sourceware.org/legacy-ml/binutils/2006-10/msg00377.html
> > >>
> > >> I haven't checked if the extension is still in use.  It is probably
> > >> still in use (in some form), since it was created to address a
> > >> shortcoming of ELF at that time.
> >
> > We still use DT_GNU_HASH on GNU/Linux.  Most Linux distributions
> > disabled DT_HASH generation and switched to DT_GNU_HASH exclusively
> > (except for glibc).  This means that for GNU/Linux, DT_GNU_HASH support
> > is de facto mandatory, and has been for many, many years.
>
> FreeBSD also uses DT_GNU_HASH and I agree it's the de facto standard.
> This is IMO unrelated to the question of the usefulness of this
> particular non-portable typedef.

yeah, Android defaults to gnu hash when targeting new enough devices
(and _both_ hashes when targeting older devices, so you get the best
of both worlds) --- my question was "should anyone expect to see this
in <elf.h>".

i actually have a bunch of TODOs wrt upstreaming some stuff to
FreeBSD. https://github.com/freebsd/freebsd-src/pull/1141 is most of
it, but i left out R_ARM_TLS_DESC because you already have SWI24 there
which i _assume_ is obsolete for FreeBSD too, but i didn't know. i
also didn't send you all the glibc source compatibility #defines i
have (where the same constant has a slightly different name), and i
haven't tried to be _complete_ either. let me know if you'd like "all
the constants" from the docs i've referenced. (or if you only want to
have the stuff FreeBSD is actually using. i've just been feeling like
a bad open source citizen growing my collection of extra stuff i've
needed on top of elf_common.h without finding the time to send it
upstream...)

> -- Brooks

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.