OSABI on Linux Distros

Suprateeka R Hegde hegdesmailbox@gmail.com
Fri Jan 1 00:00:00 GMT 2016


On 13-Jun-2016 08:56 PM, Carlos O'Donell wrote:
> On 06/11/2016 02:44 AM, Suprateeka R Hegde wrote:
>> On 11-Jun-2016 02:52 AM, Roland McGrath wrote:
>>>> What is the reason why we emit OSABI value as "UNIX - System V"
>>>> (ELFOSABI_SYSV) even on GNU/Linux systems? Shouldn't it be just "GNU"
>>>> (ELFOSABI_GNU)?
>>>
>>> In GNU systems the use of this field is specifically to indicate that
>>> certain GNU extensions to ELF are used in the particular object.  In
>>> particular, if any .dynsym entries use STT_GNU_IFUNC o STB_GNU_UNIQUE,
>>> then e_ident[EI_OSABI] must be ELFOSABI_GNU.
>>
>> OK. I understood this part. But then I did not know this set is
>> partial. I thought use of *any* GNU specific extension should mark it
>> as GNU OSABI.
>>
>> For instance, GNU_RELRO, GNU_EH_FRAME, GNU_STACK, etc. Even with all
>> these, it is still marked SYSV ABI.
>
> I'm not as authoritative on this as Roland is, but in my opinion I expect
> that because all three of these entries are optional they do not constitute
> a change in the EI_OSABI.
>
> You can ignore GNU_RELRO without any problem, you just won't have a
> read-only segment after relocation.
>
> You can ignore GNU_STACK without any problems, it's information
> for the dynamic loader to set default stack permissions. When unset the
> glibc dynamic loader will use sensible per-machine defaults, likewise
> other implementations should also.
>
> The GNU_EH_FRAME can be ignored if you're not using the GNU-based
> unwinder which uses this PT_* entry to find .eh_frame_hdr.
>
> Other dynamic linkers should ignore program header segments they don't
> understand, and thus the above optionally processed entries should not
> change the EI_OSABI.

You are considering only dynamic linker here.

>
>> 1. Do we have a documented list of GNU extensions that are necessary
>> to mark an ELF as GNU ABI?
>
> Not that I am aware of. H.J. might better answer this question.

I shall wait for the answer.

>
>> 2. Why the list is partial? Why not all GNU extensions?
>
> Only the required GNU extensions should mark EI_OSABI as ELFOSABI_GNU.
>
> If you don't implement STT_GNU_IFUNC or STB_GNU_UNIQUE then things
> actually fail.

It depends on what you are considering here. You considered only dynamic 
linker. I consider even non-GNU tools that reads ELF. When such a tool 
encounters SYSV as the ABI, it cannot do much. However, if the tool can 
see that the ELF has GNU extensions, then it can do better job of 
dumping GNU specific ELF details.

My actual question is what is the harm if we mark GNU ABI for *any* GNU 
extension and not restrict it to a partial list.

--
Supra



More information about the Gnu-gabi mailing list