loadbase alignment - ld.so/prelink/kernel or bfd_elf_bfd_from_remote_memory() bug?

Jakub Jelinek jakub@redhat.com
Wed Aug 15 15:08:00 GMT 2007


On Wed, Aug 15, 2007 at 03:56:10PM +0200, Jan Kratochvil wrote:
> bfd_elf_bfd_from_remote_memory() would almost work for general ELF files but it
> fails (I have no simple testcase) now due to the ELF `Base address' alignment.
> BFD uses `& -i_phdrs[i].p_align' for the VMA addresses but the real mapping
> is only PAGE_SIZE aligned (illustrated in the `BEFORE' dumps below).
> 
> For x86_64:
> 
> * bfd_elf_bfd_from_remote_memory() expects `loadbase' is P_ALIGN aligned.
> 
>   * GCC on x86_64 produces P_ALIGN 0x200000 == 2MB.

If bfd_elf_bfd_from_remote_memory() doesn't handle it, then it should be
fixed.  The current ld.so/prelink/kernel behavior is desirable.

	Jakub



More information about the Binutils mailing list