This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Fix several mix up between octets and bytes in ELF program headers
- From: Christian Eggers <ceggers at gmx dot de>
- To: Alan Modra <amodra at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 05 Dec 2019 06:40:14 +0100
- Subject: Re: [PATCH] Fix several mix up between octets and bytes in ELF program headers
- References: <20191125084333.30248-1-ceggers@gmx.de> <20191204232034.GJ28726@bubble.grove.modra.org>
Hi Alan,
Am Donnerstag, 5. Dezember 2019, 00:20:34 CET schrieb Alan Modra:
> I'm wondering if you would be better off leaving all the values as
> octets when written to file. There are things in the ELF spec, like
> p_offset mod pagesize == p_vaddr mod pagesize, that assume p_offset
> and p_vaddr have the same units.
as in my previous patches, I tried to keep as much as it is and reduce the
changes to a minimum. But this is not necessarily the "correctest" way to do
it. When analyzing the existing code, I came to the conclusion, that sizes are
currently handled in octets while addresses are handled in bytes.
Doing everything in the same unit would also look more consistent for me.
Using "bytes" (as mentioned in the ELF spec) would introduce the risk of
running into trouble for things like DWARF debug information (even if these
sections are not part of the program headers). Using octets should be more
future proof.
>
> I'm not saying you shouldn't make this change. The ELF spec says it
> "supports various processors with 8-bit bytes and either 32-bit or
> 64-bit architectures", so every place in the spec that says "byte"
> needs some translation for your architecture anyway. Just, have you
> considered leaving all the ELF file values as octets?
I will try to do everything in octets and provide a v2 version if this patch.
This may take a few days... After that you can decide, which version fits
better.
regards
Christian