[PATCH v7] MIPS: Sync elf.h from binutils

Maciej W. Rozycki macro@orcam.me.uk
Fri Aug 11 17:43:01 GMT 2023


Hi Florian,

 Cc-ing binutils now, to get a record of this discussion there.

> >  The EF_* definitions were added on top of preexisting E_* macros back in 
> > 1998 by Ulrich Drepper with commit c3966b88eeb ("Update.") and only this:
> >
> > 	* elf/elf.h: Add lots of new symbols from Irix and Solaris.
> 
> My concern was adding EF_* constants to glibc that duplicate E_*
> constants that are used in binutils.  I think we should either change
> binutils to use the EF_* constants, too, or for these legacy constants,
> use the E_* prefix in glibc as well.

 It's not a problem: as long as we reach consensus I can update binutils 
accordingly, and we can discard E_* constants from there at any time if 
needed as they are for BFD use only and we don't offer any stable BFD API.

> Not sure if this a reasonable position, though.

 So I did a little more research on this topic and came across this thread 
of mine from decades ago, and specifically this message coming from the 
lost world: <https://sourceware.org/ml/binutils/2002-07/msg00681.html>. 
Clearly IRIX used to use EF_* macros, just as I thought and just as has 
used the Linux kernel (and MTI never came to finishing their promised 
psABI spec, where it only says "To be supplied" in the relevant part[1]).

 So while we may have to keep the few already existing in <elf.h>, just 
because we were unfortunate enough to make them a part of our API back in 
1996:

	* elf/elf.h: Add some new constants from recent Cygnus ELF
	header files.

having likely taken them as a Cygnus invention without due consideration, 
I think we ought to refrain from adding new E_* macros and stick to EF_* 
instead.

 NB the whole thread referred above might be worth reviewing for anyone 
interested in these matters.  Here's a reference for the earlier part:
<https://lore.kernel.org/r/Pine.GSO.3.96.1020724182704.27732L-100000@delta.ds2.pg.gda.pl/>
as the discussion started on the old MIPS/Linux mailing lists first and 
then was carried over to binutils as well.

References:

[1] "MIPS ABIs Described", MIPS Technologies, Inc., Document Number: 
    MD00305, Revision 1.3, 2002/12/02, Chapter 7. "ELF object code", p. 24
    <https://web.archive.org/web/20140911162016/https://dmz-portal.mips.com/mw/images/f/fe/MD00305-2B-ABIDESC-SPC-01.03.pdf>

  Maciej


More information about the Binutils mailing list