Hello,

   I'm interested in learning gas (gnu assembler) on the openbsd
platform. i started getting some intro documentation at
www.linuxassembly.org and try out a "Hello World" code below. on a
openbsd 3.7 GENERIC.

$ cat hello.s
.data

msg:
        .ascii  "Hello, World!\n"
        len = . - msg

.text

        .global _start

_start:

        movl    $len,%edx
        movl    $msg,%ecx
        movl    $1,%ebx
        movl    $4,%eax
        int     $0x80

        movl    $0,%ebx
        movl    $1,%eax
        int     $0x80
 
and compiled it as indicated on the www.linuxassembly.org site

$ as -o hello.o hello.s
$ ld -s -o hello hello.o
$ hello
sh: hello: Operation not permitted

i got a Operation not Permitted .. i tried building it as root but it
didn't help =/ same result. i tried checking the openbsd files for
some clue and i found this

$ file /bin/ls <--- openbsd ls file 
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1, for
OpenBSD, statically linked, stripped
$ file hello <---- my test program
hello: ELF 32-bit LSB executable, Intel 80386, version 1, statically
linked, stripped

i tried running the code on a linux box and it worked..

my linux box:

[EMAIL PROTECTED]:~/pfunix$ as -o hello.o hello.s
[EMAIL PROTECTED]:~/pfunix$ ld -s -o hello hello.o
[EMAIL PROTECTED]:~/pfunix$ hello
Hello, World!
[EMAIL PROTECTED]:~/pfunix$ file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
statically linked, stripped


it is true that since I'm a beginner and it worked on linux .. it's a
normal reaction to go where the first trial works (linux) ... but as
for me .. i really want it to work on OpenBSD (eager) =) so any help,
suggestions.. or just point me to a ton of docs will be greatly
appreciated.. i noticed that the results of "file hello" and "file ls"
are almost identical except for the "file ls" having the "for OpenBSD"
on it .. is there a setting that will make OpenBSD do this for you
automatically? (let openbsd stamp the file with "for OpenBSD") or do i
need to put it manually?



Thanks In Advance, 
Edgar

Reply via email to