This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix several mix up between octets and bytes in ELF program headers

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]