site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com 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 Jonas _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... 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. This email sent to site_archiver@lists.apple.com