Re: Executable entry point
Re: Executable entry point
- Subject: Re: Executable entry point
- From: Jonas Maebe <email@hidden>
- Date: Tue, 20 Mar 2007 01:18:10 +0100
On 19 Mar 2007, at 17:24, Filipe Cabecinhas wrote:
My compiler outputs files for nasm so I compile them like this:
nasm -fmacho hello.asm
ld -o hello hello.o -lrts -L../build -e _start -lc
So it links with libc. But, when I try to run it, I get:
(gdb) disassemble dyld_stub_write
Dump of assembler code for function dyld_stub_write:
0xa0011230 <dyld_stub_write+0>: jmp 0x900101b0 <write>
End of assembler dump.
(gdb) r
Starting program: /Users/filcab/dev/compiladores/tests/hello
Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/
operand.
0x00004005 in dyld_stub_write ()
(gdb) x /i $eip
0x4005 <dyld_stub_write>: hlt
I'm guessing (maybe I'm wrong) that the dynamic linker isn't
loading libc.
Any clues?
This suggests to me that dyld doesn't get initialised properly. Have
you tried linking in /usr/lib/crt1.o already? In that case, you may
not be able to specify an alternate entry point though. Another
option may be to add the source code of crt1.o to your program so you
can change its symbol names for entry point and where it jumps to in
your program after it finishes initialising, but note that it was
quite a convoluted mess the last time I looked at it.
Jonas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden