This is the mail archive of the binutils@sourceware.org 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]

[PATCH v3 0/2] Fix several mix up between octets and bytes in ELF program headers


forgot the subject in my first mail....

On Wed, 18 Dec 2019 12:42:57 +1030, Alan Modra wrote:
> Overall this is looking good, and I think your decision to make the
> internal units for p_vaddr, p_paddr and sh_addr octets has worked out
> well.

Sorry for responding late. I do the binutils SDMA port in my leisure
time. In the last two months I had to focus on my primary work and on my
family. I hope that upstreaming of my SDMA work can be finished soon.

> But it looks like you have missed a few places that need an octet per
> byte factor...
In order to ease review for you, I did only slight changes on the v2
patch and added the missing parts in a follow-up patch.

> ...eg. elf.c search for filehdr_vaddr.  Symbol values for
> an address are in bytes, at least internally.
added in the follow-up.

> There's another one at
> around line 7190 of elf.c where we have a comparison of an expression
> involving p_vaddr and a section vma.
also added in the follow-up.

> That one raises the question of
> what to do with alignment.  Presumably, section->alignment_power stays
> in bytes since it is most often used with section->vma.
I added a comment on the struct member in the follow-up patch.

> So that's
> another thing that needs converting if used to align p_vaddr/p_paddr.
In the follow-up, I also checked all users of section->alignment_power.

> Also elfcode.h bfd_from_remote_memory uses p_vaddr without converting
> to bytes.
done in the follow-up.

> Also search for phdr_lma in elf.c.
done in the follow-up.

> IS_CONTAINED_BY_LMA needs a fix too,
changed in v3 of the first patch

> and this in elf.c "map->p_paddr = matching_lma->lma"
done in the follow-up

> and the alignment a little later.
unsure, maybe I didn't find

> You also need to correct code in bfd_elf_final_link using sh_addr when
> setting up DT_REL/DT_RELA.  There's a comparison between sh_addr and
> vma.
done in the follow-up

> The following in elf32-rx.c where octets per byte is always one (and
> thus the file needs no change) is bogus, please remove, and the change
> to elf64-ia64-vms.c too:
removed in v3 of the first patch

regards
Christian




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