Skip to contentSkip to conversation

Use of the EI_OSABI field

parisc-linux John Marvin 5 participants 13 messages Nov 21, 2000 – Nov 25, 2000

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines

Another glibc issue (which is why I'm sending this back to the list) is that there has been quite some discussion on the binutils list over the use of the EI_OSABI field. The conclusion being that it isn't really correct to use this field to discern the intendend execution platform. It's purpose is really to tell ELF tools that a file contains fields and values that need to be interpreted in a non-standard way. Since both elf32-hppa and elf64-hppa follow the standards, I'm inclined to think that the gnu tools should set EI_OSABI to zero for both HPUX and Linux targets.

I don't read the binutils mailing list, so I checked the archive. In my opinion I didn't see a discussion, I saw H.J. Lu repeatedly asserting this "fact". He may or may not be correct about original intention, but the implementation so far has been that EI_OSABI is used to tell what the target platform is. That is what FreeBSD is doing, that is what HP-UX is doing, and that is what the IA-64 Unix System V Application Binary Interface specifies:

http://developer.intel.com/design/IA-64/Downloads/24537002.pdf

Note that the second paragraph in section 1.1 of that specification includes the following:

This document is the result of consensus among operating system vendors intending to provide UNIX and UNIX workalike operating systems on the IA-64 architecture. The vendors participating in this effort include Intel, Sun Microsystems, SCO, IBM, SGI, Cygnus Solutions, VA Linux Systems, HP, and Compaq.

So, If the specification is wrong according to H.J. Lu, why did both Cygnus and VA Linux Systems not object to this:

Section 4.1.1.4 Operating System Identification

The e_ident[EI_OSABI] value identifies the operating system and ABI to which the object is targeted, as listed in Table 4-1.

Table 4-1 lists the various ELFOSABI_* fields, e.g. ELFOSABI_HPUX, ELFOSABI_NETBSD, ELFOSABI_LINUX, etc.

Note also, that the current mechanism for us to be able to differentiate elf executables in the Linux kernel is the machine dependent elf_check_arch() macro, whose only argument is a pointer to a elf32_hdr or elf64_hdr. I think it would be ugly to try to get the .note.ABI-tag section first for every exec of a new binary in order to determine what the target ABI is.

In my opinion, unless H.J. Lu can get the IA-64 ABI changed, it is too late to assert his view of what that field was supposed to be. Please leave the EI_OSABI field set to ELFOSABI_LINUX until a better consensus on this issue is reached.

John Marvin
[email protected]

#1 lore raw

cc to binutils because John makes some salient points.

Quoted 46 lines · John Marvin
Quoted 8 lines

Another glibc issue (which is why I'm sending this back to the list) is that there has been quite some discussion on the binutils list over the use of the EI_OSABI field. The conclusion being that it isn't really correct to use this field to discern the intendend execution platform. It's purpose is really to tell ELF tools that a file contains fields and values that need to be interpreted in a non-standard way. Since both elf32-hppa and elf64-hppa follow the standards, I'm inclined to think that the gnu tools should set EI_OSABI to zero for both HPUX and Linux targets.

I don't read the binutils mailing list, so I checked the archive. In my opinion I didn't see a discussion, I saw H.J. Lu repeatedly asserting this "fact". He may or may not be correct about original intention, but the implementation so far has been that EI_OSABI is used to tell what the target platform is. That is what FreeBSD is doing, that is what HP-UX is doing, and that is what the IA-64 Unix System V Application Binary Interface specifies:

http://developer.intel.com/design/IA-64/Downloads/24537002.pdf

Note that the second paragraph in section 1.1 of that specification includes the following:

This document is the result of consensus among operating system vendors intending to provide UNIX and UNIX workalike operating systems on the IA-64 architecture. The vendors participating in this effort include Intel, Sun Microsystems, SCO, IBM, SGI, Cygnus Solutions, VA Linux Systems, HP, and Compaq.

So, If the specification is wrong according to H.J. Lu, why did both Cygnus and VA Linux Systems not object to this:

Section 4.1.1.4 Operating System Identification

The e_ident[EI_OSABI] value identifies the operating system and ABI to which the object is targeted, as listed in Table 4-1.

Table 4-1 lists the various ELFOSABI_* fields, e.g. ELFOSABI_HPUX, ELFOSABI_NETBSD, ELFOSABI_LINUX, etc.

Note also, that the current mechanism for us to be able to differentiate elf executables in the Linux kernel is the machine dependent elf_check_arch() macro, whose only argument is a pointer to a elf32_hdr or elf64_hdr. I think it would be ugly to try to get the .note.ABI-tag section first for every exec of a new binary in order to determine what the target ABI is.

Quoted 7 lines

In my opinion, unless H.J. Lu can get the IA-64 ABI changed, it is too late to assert his view of what that field was supposed to be. Please leave the EI_OSABI field set to ELFOSABI_LINUX until a better consensus on this issue is reached.

John Marvin
[email protected]

I'm happy enough to leave things as they are in puffin CVS, but these changes haven't been merged back to sourceware yet, partly because I had some doubts myself as to whether setting EI_OSABI was correct. H.J. Lu wasn't the only one arguing that EI_OSABI should be left at zero; Ulrich Drepper also was quite vehement against changing sourceware FreeBSD binutils.

BTW, it's not too hard to check .note.ABI-tag. The linker arranges for a PT_NOTE program header entry to point to it, and the section itself is virtually guaranteed to be read in with the header as it's placed right after the header along with .interp.

Alan Modra

Signature · 1 line
Linuxcare.  Support for the Revolution.
#2 lore raw
Quoted 2 lines · Alan Modra

Ulrich Drepper also was quite vehement against changing sourceware FreeBSD binutils.

I've never said anything about any *BSD, why should I? The *BSD people wanted to change the Linux binutils.

Anyway, the ABI value is zero unless you implement ELF extensions.

Signature · 3 lines
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
#3 lore raw
Quoted 7 lines · Ulrich Drepper
Quoted 2 lines · Alan Modra

Ulrich Drepper also was quite vehement against changing sourceware FreeBSD binutils.

I've never said anything about any *BSD, why should I? The *BSD people wanted to change the Linux binutils.

Sorry, I stated that badly.

Quoted 1 line

Anyway, the ABI value is zero unless you implement ELF extensions.

Exactly what is an "ELF extension"? Anything outside gABI or "gABI + psABI"? Handly the latter, as it seems to me that a processor specific ABI can specify extensions. There's also the awkward possibility that a psABI may specify an extension that is later incorporated into a new revision of the gABI (eg. hpux and DT_INIT_ARRAY) Does that mean that if a new revision of the gABI completely incorporates all previous extensions, that EI_OSABI should become zero?

Yes, I'm arguing that "No ELF extensions => EI_OSABI == 0" is not necessarily true, but I'm _not_ arguing that changing x86 Linux binutils is wise. Historical usage is important. If we were to change x86 Linux binutils to set EI_OSABI, then that can only be after a considerable period of time to allow code such as glibc to accept a new branding.

Alan Modra

Signature · 1 line
Linuxcare.  Support for the Revolution.
#4 lore raw
Quoted 2 lines · Alan Modra

Exactly what is an "ELF extension"? Anything outside gABI or "gABI + psABI"?

Anything beyond the psABI that cannot be handled by the rules in the gABI.

Signature · 3 lines
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
#5 lore raw
In reply to Alan Modra
Quoted 4 lines · Alan Modra
Quoted 2 lines

Anyway, the ABI value is zero unless you implement ELF extensions.

Exactly what is an "ELF extension"? Anything outside gABI or

ELF extension is something whose interpretation is not documented in neither gABI nor psABI. HP's old ELF is a good example since it didn't implement DT_INIT/DT_FINI, but added DT_INIT_ARRARY/DT_FINI_ARRAY. A normal ELF tool will have a hard time to interpret those fields and their values.

H.J.

#6 lore raw
Quoted 11 lines · H . J . Lu
Quoted 4 lines · Alan Modra
Quoted 2 lines

Anyway, the ABI value is zero unless you implement ELF extensions.

Exactly what is an "ELF extension"? Anything outside gABI or

ELF extension is something whose interpretation is not documented in neither gABI nor psABI. HP's old ELF is a good example since it didn't implement DT_INIT/DT_FINI, but added DT_INIT_ARRARY/DT_FINI_ARRAY. A normal ELF tool will have a hard time to interpret those fields and their values.

Neither you nor Ulrich have responded to John's point that the IA64 psABI states
"The e_ident[EI_OSABI] value identifies the operating system and ABI to
which the object is targeted"

Granted, this is only in a processor specific ABI, but it does flatly contradict your assertions that the purpose of EI_OSABI is to flag the presense of ELF extensions.

Alan Modra

Signature · 1 line
Linuxcare.  Support for the Revolution.
#7 lore raw
Quoted 14 lines · Alan Modra
Quoted 11 lines · H . J . Lu
Quoted 4 lines · Alan Modra
Quoted 2 lines

Anyway, the ABI value is zero unless you implement ELF extensions.

Exactly what is an "ELF extension"? Anything outside gABI or

ELF extension is something whose interpretation is not documented in neither gABI nor psABI. HP's old ELF is a good example since it didn't implement DT_INIT/DT_FINI, but added DT_INIT_ARRARY/DT_FINI_ARRAY. A normal ELF tool will have a hard time to interpret those fields and their values.

Quoted 9 lines

Neither you nor Ulrich have responded to John's point that the IA64 psABI states
"The e_ident[EI_OSABI] value identifies the operating system and ABI to
which the object is targeted"

Granted, this is only in a processor specific ABI, but it does flatly contradict your assertions that the purpose of EI_OSABI is to flag the presense of ELF extensions.

When I was at the IA64 ABI meeting yesterday, we were looking at the EI_OSABI issue. Everyone at the IA64 ABI meeting agreed that what Ulrich and I had said was the correct understanding.

"The e_ident[EI_OSABI] value identifies the operating system and ABI to which the object is targeted" just means if the e_ident[EI_OSABI] value is not ELFOSABI_NONE, you have to look somewhere else in addition to gABI and IA64 psABI to interpret the ELF fields/values specific to that OS. Otherwise, gABI and IA64 psABI are sufficient.

Signature · 1 line
H.J. Lu ([email protected])
#8 lore raw
Quoted 6 lines · H . J . Lu

When I was at the IA64 ABI meeting yesterday, we were looking at the EI_OSABI issue. Everyone at the IA64 ABI meeting agreed that what Ulrich and I had said was the correct understanding.

"The e_ident[EI_OSABI] value identifies the operating system and ABI to which the object is targeted" just means if the e_ident[EI_OSABI]

Then is this *extremely* misleading text going to be changed??? "the operating system and" needs to be deleted in the _official_ _published_ specification.

Signature · 1 line
-- David  ([email protected])
#9 lore raw
Quoted 5 lines · David O'Brien
Quoted 4 lines · H . J . Lu

When I was at the IA64 ABI meeting yesterday, we were looking at the EI_OSABI issue. Everyone at the IA64 ABI meeting agreed that what Ulrich and I had said was the correct understanding.

Quoted 8 lines
Quoted 2 lines

"The e_ident[EI_OSABI] value identifies the operating system and ABI to which the object is targeted" just means if the e_ident[EI_OSABI]

Then is this *extremely* misleading text going to be changed??? "the operating system and" needs to be deleted in the _official_ _published_ specification.

I will bring this issue up to ia64 psABI and gABI.

Signature · 1 line
H.J. Lu ([email protected])
#10 lore raw
In reply to Alan Modra
Quoted 6 lines · Alan Modra

"The e_ident[EI_OSABI] value identifies the operating system and ABI to
which the object is targeted"

Granted, this is only in a processor specific ABI, but it does flatly contradict your assertions that the purpose of EI_OSABI is to flag the presense of ELF extensions.

The meaning of the field changed over time. Or better said, some people initially understood it differently.

Signature · 3 lines
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
#11 lore raw
Quoted 10 lines · Ulrich Drepper
Quoted 6 lines · Alan Modra

"The e_ident[EI_OSABI] value identifies the operating system and ABI to
which the object is targeted"

Granted, this is only in a processor specific ABI, but it does flatly contradict your assertions that the purpose of EI_OSABI is to flag the presense of ELF extensions.

The meaning of the field changed over time. Or better said, some people initially understood it differently.

Then lets get the _official_ wording changed. Obviously my
interpretation wasn't unreasonable. And the world does not need to have
you as a premadona keeper of the [unwritten] rules of the land.

Signature · 1 line
-- David  ([email protected])
#12 lore raw
In reply to Ulrich Drepper
Quoted 7 lines · Ulrich Drepper
Quoted 2 lines · Alan Modra

Ulrich Drepper also was quite vehement against changing sourceware FreeBSD binutils.

I've never said anything about any *BSD, why should I? The *BSD people wanted to change the Linux binutils.

No (don't put words in my mouth Ulrich as you'll be wrong 99% of the time). I wanted the Sourceware Binutils to set the EI_OSABI to "ELFOSABI_LINUX" when targeting Linux.

Signature · 1 line
-- David  ([email protected])