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

Openbsd 3.7's Gnu Assembler (as) file "tagging" behaviour?



i found another "how do i write hello world in BSD" and i tried it out
here's the code

.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



Visit your host, monkey.org