Port-sparc64 archive

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

Re: generating sparc executables



On Sat, Apr 05, 2008 at 12:59:30PM +0100, raymond.meyer%rambler.ru@localhost 
wrote:
> Hi, I'm trying to write a simple sparc assembler. I've got sparcv9 docs, so I 
> think I know how to generate binary instructions. I don't know how to 
> generate NetBSD sparc ELF executable files without gcc.

The only tricky part is that you need a note section in the binary that
marks it as a NetBSD executable. Something like this:

.section ".note.netbsd.ident", "", @note
        .p2align        2
        .long           7               ! ELF_NOTE_NETBSD_NAMESZ
        .long           4               ! ELF_NOTE_NETBSD_DESCSZ
        .long           1               ! ELF_NOTE_TYPE_NETBSD_TAG
        .ascii          "NetBSD\0\0"    ! ELF_NOTE_NETBSD_NAME
        .long           499005800       ! __NetBSD_Version__
        .p2align        2

Just using cc and passing the .s files is easier, though.

Martin


Home | Main Index | Thread Index | Old Index