Skip to contentSkip to conversation

programme header

DISCUSSION ishare 2 participants 4 messages Mar 19, 2013 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAKOQZ8xhEagntf7BXM9A7kU0b9zyEbHtc2dv2gDkKAGUuUCc9w@mail.gmail.com

ishare

author
#2 lore raw
Quoted 11 lines · Ian Lance Taylor
Quoted 4 lines · ishare

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.

Quoted 1 line

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!

Quoted 1 line

Ian

#3 lore raw
Quoted 4 lines · ishare

I am linking my kernel by a link script. its contens is as below:

I think it will work ,but ld report that "No enough room for programme header",what is the reason? what should I do ?

The first thing you do is ask yourself why you're using a link script of your own, when most architectures come with a working link script already.

The second thing you do is *read the script* - there's a big copmment in there:

/* 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. */

Hope that helps.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130318/f98835e3/attachment.bin

author
#4 lore raw
Quoted 10 lines · Valdis.Kletnieks at vt.edu
Quoted 4 lines · ishare

I am linking my kernel by a link script. its contens is as below:

I think it will work ,but ld report that "No enough room for programme header",what is the reason? what should I do ?

The first thing you do is ask yourself why you're using a link script of your own, when most architectures come with a working link script already.

Quoted 6 lines

The second thing you do is *read the script* - there's a big copmment in there:

/* 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. */

because I need to generate a .so for sysenter used

thanks!

Quoted 2 lines

Hope that helps.

#5 lore raw
Quoted 1 line · ishare

because I need to generate a .so for sysenter used

And that solves what problem for you, exactly?

Consider that most architectures that use sysenter manage to do so
without having to worry about a .so for it (or if they really do need
one, they already create a .so). So what problem are you trying to
solve by using a .so?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130319/25802d77/attachment.bin