tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

NetBSD/usermode link issues



Dear folks,

as you might have read on tech-kern, I'm still having trouble getting the
./build.sh built kernel to run. On closer inspection, i stumbled on this
two things.

For one, why are the crt*.o placed at this address? This is what currently
limits the amount of memory NetBSD/usermode can play with for it gives an
linker error when i put the kernel up higher.

Secondly, the init and finish code are different. The tools variant forgets to
put some code in there and it thus crashes on uninitialized code at startup.
When I go to the build directory and force a relink of `netbsd' by removing it
and typing `make' it creates the working copy.

I've added a dump of the two heads and tails to make clear what I found.

Any comments or reactions are welcome! Thanks in advance,

Reinoud

netbsd:     file format elf64-x86-64


Disassembly of section .text:

0000000070000000 <__start>:
    70000000:	48 83 e4 f0          	and    $0xfffffffffffffff0,%rsp
    70000004:	48 83 ec 08          	sub    $0x8,%rsp
    70000008:	48 89 d7             	mov    %rdx,%rdi
    7000000b:	48 89 ce             	mov    %rcx,%rsi
    7000000e:	48 89 da             	mov    %rbx,%rdx

....

0000000070266a6a <__libc_thr_init_stub>:
    70266a6a:	c3                   	retq   

Disassembly of section .init:

00000000004001c0 <_init-0x10>:
  4001c0:	e8 07 00 c0 6f       	callq  700001cc <___start+0x172>
  4001c5:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
  4001cc:	00 00 00 
  4001cf:	90                   	nop

00000000004001d0 <_init>:
  4001d0:	48 83 ec 08          	sub    $0x8,%rsp

Disassembly of section .fini:

0000000070266a70 <_fini-0x10>:
    70266a70:	e8 16 97 d9 ff       	callq  7000018b <___start+0x131>
    70266a75:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
    70266a7c:	00 00 00 
    70266a7f:	90                   	nop

0000000070266a80 <_fini>:
    70266a80:	48 83 ec 08          	sub    $0x8,%rsp
netbsd:     file format elf64-x86-64


Disassembly of section .text:

0000000070000000 <__start>:
    70000000:	48 83 e4 f0          	and    $0xfffffffffffffff0,%rsp
    70000004:	48 83 ec 08          	sub    $0x8,%rsp
    70000008:	48 89 d7             	mov    %rdx,%rdi
    7000000b:	48 89 ce             	mov    %rcx,%rsi
    7000000e:	48 89 da             	mov    %rbx,%rdx

....

000000007026cfc6 <__libc_thr_init_stub>:
    7026cfc6:	c3                   	retq   

Disassembly of section .init:

0000000000400150 <_init>:
  400150:	48 83 ec 08          	sub    $0x8,%rsp
  400154:	e8 22 00 c0 6f       	callq  7000017b <___start+0x165>
  400159:	48 83 c4 08          	add    $0x8,%rsp
  40015d:	c3                   	retq   

Disassembly of section .fini:

000000007026cfd0 <_fini>:
    7026cfd0:	48 83 ec 08          	sub    $0x8,%rsp
    7026cfd4:	e8 61 31 d9 ff       	callq  7000013a <___start+0x124>
    7026cfd9:	48 83 c4 08          	add    $0x8,%rsp
    7026cfdd:	c3                   	retq   


Home | Main Index | Thread Index | Old Index