I tried compiling the following code in OpenBSD using Gas (Gnu
Assembler) but i got a
"Operation not permitted" .. please note: that... the mounts i have
on OpenBSD are not set with the "noexec" command
.data
msg: .asciz "Hello, world.\n"
len = . - msg - 1
.text
.global _start
_start: .
pushl $len
pushl $msg
pushl $1
movl $4, %eax
call do_syscall
addl $12, %esp
pushl $0
movl $1, %eax
call do_syscall
do_syscall:
int $0x80
ret
i compiled it on a FreeBSD machine and the other one on my OpenBSD box
** FreeBSD box
$as -o hello.o hello.s
$ld -o hello hello.o
$./hello
Hello, world.
$file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD),
statically linked, not stripped
** OpenBSD box
$as -o hello.o hello.s
$ld -o hello hello.o
$./hello
sh: ./hello: Operation not permitted
$file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1, statically
linked, not stripped
i noticed that the Gnu (AS) that FreeBSD uses will automatically
"tagged" the file FreeBSD where as the Gnu (AS) that OpenBSD doesn't.
is there a patch that can resolve this or a tweak of some sort .. I
really want it to work on OpenBSD and not on the other BSD .. i picked
OpenBSD coz it basically has all the docs I'll ever need together with
the OS....
Regards,
Edgar