RFC: Rewrite copy_private_bfd_data in elf.c

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RFC: Rewrite copy_private_bfd_data in elf.c

H.J. Lu-27
Hi,

I'd like to clean up copy_private_bfd_data in elf.c. It is supposed
to copy ELF program header. But it checks p_paddr in ELF progam header,
which isn't specified by ELF specification at all and messs around
progam header. I'd like to rewrite copy_private_bfd_data to handle
copying ELF program header properly. It will

1. Copy the entire ELF program header if none of the sections
referenced by program header is removed. It won't change the order
of segments nor merge them.
2. It will adjust ELF program header if any of the sections referenced
by program header is removed. It won't change the order of segments nor
merge them. It will only remove a segment if all sections it covers
are removed.

Does anyone have any comments?

Jakub, you are the last person who made major changes to it:

http://sourceware.org/ml/binutils/2002-11/msg00783.html

Do you have any comments?

Thanks.

H.J.
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Rewrite copy_private_bfd_data in elf.c

Nick Clifton
Hi H. J.

> I'd like to clean up copy_private_bfd_data in elf.c. It is supposed
> to copy ELF program header. But it checks p_paddr in ELF progam header,
> which isn't specified by ELF specification at all

Actually it is specified:

   p_paddr     On systems for which physical addressing is relevant,
               this member is reserved for the segment's physical
               address. This member requires operating system specific
               information, which is described in the appendix at the
               end of Book III.

> and messs around progam header. I'd like to rewrite
 > copy_private_bfd_data to handle copying ELF program header properly.
> It will

> 1. Copy the entire ELF program header if none of the sections
> referenced by program header is removed. It won't change the order
> of segments nor merge them.

What about if sections have been added ?  Or if the size of any of the
sections has changed ?  Or their load/run addresses have been changed ?
  Or their attributes ?

Cheers
   Nick



Reply | Threaded
Open this post in threaded view
|

Re: RFC: Rewrite copy_private_bfd_data in elf.c

H.J. Lu-27
On Fri, Feb 03, 2006 at 01:26:55PM +0000, Nick Clifton wrote:

> Hi H. J.
>
> >I'd like to clean up copy_private_bfd_data in elf.c. It is supposed
> >to copy ELF program header. But it checks p_paddr in ELF progam header,
> >which isn't specified by ELF specification at all
>
> Actually it is specified:
>
>   p_paddr     On systems for which physical addressing is relevant,
>               this member is reserved for the segment's physical
>               address. This member requires operating system specific
>               information, which is described in the appendix at the
>               end of Book III.

Mine says

p_paddr
    On systems for which physical addressing is relevant, this member
is reserved for the segment's physical address. Because System V
ignores physical addressing for application programs, this member has
unspecified contents for executable files and shared objects.

>
> >and messs around progam header. I'd like to rewrite
> > copy_private_bfd_data to handle copying ELF program header properly.
> >It will
>
> >1. Copy the entire ELF program header if none of the sections
> >referenced by program header is removed. It won't change the order
> >of segments nor merge them.
>
> What about if sections have been added ?  Or if the size of any of the
> sections has changed ?  Or their load/run addresses have been changed ?
>  Or their attributes ?
>

In that case, we need something different since we are no longer
copying program header. We are rewritting program header.


H.J.