Subject: Re: Assembly Language Programs
To: Alessandro Coppelli <coppelli@dsea.unipi.it>
From: Martin Husemann <martin@duskware.de>
List: tech-kern
Date: 04/12/2006 11:10:25
On Wed, Apr 12, 2006 at 09:19:26AM +0200, Alessandro Coppelli wrote:
>   as -o <name>.o <name>.s
>   ld -o <name> <name>.o

Your programm will not have a specical section that identifies it as a 
NetBSD executable:

objdump -h /bin/ls 

/bin/ls:     file format elf64-sparc

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .interp       00000013  0000000000100190  0000000000100190  00000190  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.netbsd.ident 00000018  00000000001001a4  00000000001001a4  000001a4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .hash         000001a4  00000000001001c0  00000000001001c0  000001c0  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
...

You need the .note.netbsd.ident or the kernel will think your binary is a
SVR4 binary (or whatever).

You could use 

 cc -static -o <name> <name>.o

to link the program instead.

Martin