I'm trying out a simple Assembly program on a freshly installed
"OpenBSD openbsd 6.1 GENERIC#291 i386":
--- begin exit.s
# https://web.archive.org/web/20120509101207/http://lucifer.phiral.net/openbsdasm.htm
#
# $ as exit.s -o exit.o && ld exit.o -o exit && ./exit
.section ".note.openbsd.ident", "a"
.p2align 2
.long 0x8
.long 0x4
.long 0x1
.ascii "OpenBSD\0"
.long 0x
.p2align 2
.section .text
.globl _start
_start:
xorl %eax, %eax
pushl %eax # exit status
pushl %eax # extra long for C ABI
movl $1, %eax # exit syscall
int $0x80
--- end
This program assembles and links without error. However when I try to
run it, I get this:
$ as exit.s -o exit.o
$ ld exit.o -o exit
$ ./exit
zsh: abort ./exit
The identical program runs on 32-bit Linux.
Any Assembly programmers in the house know what's up?
Thanks,
Kartik
http://akkartik.name/about
No comments:
Post a Comment