Regarding linker code generation

Nick Clifton nickc@redhat.com
Wed Aug 1 17:38:00 GMT 2007


Hi Verma,

> Program Header[0]:
>     p_vaddr:      0           p_flags:    [ PF_X PF_W PF_R ]
>     p_paddr:      0           p_type:     [ PT_LOAD ]
>     p_filesz:     0x2bc1f     p_memsz:    0x2d6c8
>     p_offset:     0           p_align:    0x8000
> 
> Why linker is generating this type of header?

I am not sure exactly what you are asking here.  This header is needed because 
it is part of the ELF specification.  All loadable ELF binary files (ie either 
libraries or programs) have a header like this.

> But whenever I separate code and data segment this gives segmentation fault
> inside self relocation of run time linker.

It sounds like there is a problem inside the run time linker then.

> I am using gnu arm toolchain

Are you using the latest version ?  If not then try that.  Also try building a 
toolchain from the current mainline development sources as this *may* fix your 
problem.

> Could you please help me is this due to permiison of data segment or I have
> some other problem as in creating wrong data segment etc.

Could be.  You would need to investigate this "run time linker" you refer to.

> could you please explian me p_vaddr Vs p_paddr.

See the ELF spec for full details.  Here is a quick excerpt:

   p_vaddr
         This member gives the virtual address at which the first byte of
         the segment resides in memory.

   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.

Cheers
   Nick



More information about the Binutils mailing list