programme header
ishare
june.tune.sea at gmail.com
Mon Mar 18 21:38:49 EDT 2013
On Mon, Mar 18, 2013 at 03:02:02PM -0700, Ian Lance Taylor wrote:
> On Sun, Mar 17, 2013 at 1:54 AM, ishare <june.tune.sea at gmail.com> wrote:
> >
> >
> > when product a .so liberary , if there is not a programme header in the linker script file,
> > will the linker automaticlly generate a deault one for use ?
>
> Yes.
>
> > If I write the programme header manully , need I write it before writing section command ?
>
> No.
I am linking my kernel by a link script. its contens is as below:
*********************************************************************
VSYSCALL_BASE = 0xffffe000;
SECTIONS
{
. = VSYSCALL_BASE + SIZEOF_HEADERS;
.hash : { *(.hash) } :text
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
/* This linker script is used both with -r and with -shared.
For the layouts to match, we need to skip more than enough
space for the dynamic symbol table et al. If this amount
is insufficient, ld -shared will barf. Just increase it here. */
. = VSYSCALL_BASE + 0x400;
.text : { *(.text) } :text =0x90909090
.eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
.eh_frame : { KEEP (*(.eh_frame)) } :text
.dynamic : { *(.dynamic) } :text :dynamic
.useless : {
*(.got.plt) *(.got)
*(.data .data.* .gnu.linkonce.d.*)
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
} :text
}
PHDRS
{
text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
}
*******************************************************************************
I think it will work ,but ld report that "No enough room for programme header",what is the reason?
what should I do ?
thanks!
> Ian
More information about the Kernelnewbies
mailing list