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

Re: hello assembly

On Sun, Mar 21, 2004 at 08:59:02PM +0000, Ed Wandasiewicz wrote:
> $ ./hello
> ./hello[1]: syntax error: `(' unexpected
> What is wrong?
./hello is not recognized as an OpenBSD binary. AIUI this would be
because the openbsd elf header section is linked in as part of the 
c runtime. You have a couple of options:

1. Add elf2olf to your build process:
elf2olf hello

2. Create a file like the following:
.section ".note.openbsd.ident", "a"
        .p2align 2

        .long   8
        .long   4
        .long   1
        .ascii "OpenBSD\0"
        .long   0

        .p2align 2
/* eof */
and build as follows:
as -o os-note.o os-note.s
as -o hello.o hello.s
ld -o hello os-note.o hello.o