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]

Re: [patch] bfd_elf_bfd_from_remote_memory() workaround for the ELF misalignment [Re: loadbase alignment - ld.so/prelink/kernel or bfd_elf_bfd_from_remote_memory() bug?]


On Mon, Aug 20, 2007 at 09:54:28PM +0200, Jan Kratochvil wrote:
> On Wed, 15 Aug 2007 18:00:43 +0200, H.J. Lu wrote:
> > On Wed, Aug 15, 2007 at 05:13:48PM +0200, Jakub Jelinek wrote:
> > > On Wed, Aug 15, 2007 at 03:56:10PM +0200, Jan Kratochvil wrote:
> ...
> > > > 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.
> > 
> > I can see both approaches make senses. On one hand, BFD doesn't
> > know what the run-time page size is.
> ...
> > 2. Modify BFD to take the maximum run-time page size, which can
> > be set at run-time, and use it to compute base address.
> 
> You were suggesting a new parameter for bfd_elf_bfd_from_remote_memory()?
> Attached a patch using TEMPL's MINPAGESIZE value instead, isn't that sufficient?
> 

No. The new parameter should be the maximum page size at run-time,
which is >= MINPAGESIZE and may be default to MINPAGESIZE.


H.J.


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