Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] Some tweaks for ELF



On 08/27/13 10:44, Martin Husemann wrote:
> On Tue, Aug 27, 2013 at 04:37:30AM -0400, Christos Zoulas wrote:
>> Useful or not, it currently works :-)
> 
> Yes, and if we need it for compat: fine. Out of curiosity: why does linux
> produce some binaries with ET_DYN and other with ET_EXEC? We only seem
> to do ET_EXEC for native binaries.

ET_DYN can be either a shared library or a position-independent executable
(PIE). There's no way to distinguish between them, except that a PIE must
have a PT_INTERP segment.

I'm currently running on OpenBSD: all binaries produced by gcc are PIE,
and thus have the ET_DYN flag.

  http://www.skyfree.org/linux/references/ELF_Format.pdf - p.41

> 
> Anyway: I wonder if we should just do:
> 
> int elf_check_header(Elf_Ehdr *eh, bool *is_dyn)
> 
> and hardclode ET_EXEC and ET_DYN inside that function, setting *is_dyn
> to true if we find ET_DYN.
> 
> While breaking the API, we could also move the test for 0 sections inside.
> 
> Martin
> 



Home | Main Index | Thread Index | Old Index