Subject: Re: my first mac68k asm program...
To: None <port-mac68k@netbsd.org>
From: Marco van de Voort <marcov@dragon.stack.nl>
List: port-mac68k
Date: 06/20/2002 20:57:23
> 
> > On Thu, Jun 20, 2002 at 05:22:56PM +0200, Christian Groessler wrote:
> > > But it does not work:
> > > 
> > > mac68k:~/work$ as -o ahello.o ahello.s 
> > > mac68k:~/work$ ld -m m68kelfnbsd -e _start -o ahello ahello.o
> > > mac68k:~/work$ ./ahello 
> > > bash: ./ahello: cannot execute binary file
> > 
> > Which NetBSD installation are you using?  What does 'file ahello' show,
> > and what does 'file /usr/bin/ld' show?
> 
> I know that ELF needs a NETBSD identifier. I don't know what's the case with
> NETBSD/m68k and a.out.
> 
> The usually find this out, by linking a minimal C program and objdump that
> with --disassemble-all 
> 
> Also try to objdump the generated binary.

Whoops saw that you were playing ELF.

Try to add this to your source (this is i386, maybe needs fix for
endianness, but can't access a m68k from here; am at work)

# This section is needed for NetBSD to recognize a NetBSD binary as such.
# otherwise it will be startup in Linux emulation mode.

.section ".note.netbsd.ident","a"
.p2align 2

.long 7
.long 4
# ELF NOTE TYPE NETBSD TAG
.long 1
.ascii "NetBSD\0\0"
.long 199905