Gnu Assembler on Openbsd 3.7 "Operation not permitted"

2005-07-02 Thread Ted Hanna
im receiving an error on compiling using gas and ld. i did a test
compile using a hello.S that have the usuall "hello world" written in
asm. the compile went smoothly and so does the linking but i got at a
point where i am ready to run the program and got this error

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

here's the file stats 

$ ls -la hello
-rwxr-xr-x  1 dee  dee  4452 Jul  2 14:42 hello


any suggestions will be greatly appreciated.


dee



Re: Gnu Assembler on Openbsd 3.7 "Operation not permitted"

2005-07-02 Thread Ted Hanna
mount info; no "noexec" option on my /etc/fstab too 

$ mount
/dev/wd0a on / type ffs (local)
/dev/wd0d on /home type ffs (local, nodev, nosuid)
/dev/wd0e on /tmp type ffs (local, nodev, nosuid)
/dev/wd0g on /usr type ffs (local, nodev)
/dev/wd0f on /var type ffs (local, nodev, nosuid)


The code I'm trying to build using gas

$ cat hello.S
.data

msg:
 .ascii  "my OpenBSD is on GAS!\n"
 len =3D . - 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

here's how i build it 

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

it doesn't want to run at all =/ anyways... any help, comments will be
very much appreciated



dee



Re: Gnu Assembler on Openbsd 3.7 "Operation not permitted"

2005-07-02 Thread Ted Hanna
i was able to get it to work   but sadly it's on nasm .. at first
i've tried using nasm, yasm, gas and it all came to that one
conclusion "Operation not Permitted" but i was able to get this
workaround code to label the file OpenBSD so that OpenBSD will run it
.. i dunno how this is exactly done .. (I'm still thinkering) but I'll
get there :) here's what i founded out

you can check the difference when you do a : 

$ file hell
hell: ELF 32-bit LSB executable, Intel 80386, version 1, for OpenBSD,
statically linked, stripped
$ file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1, statically
linked, stripped

the first file "hell" has the id code (see below) 


section .note.openbsd.ident align=2
dd 8
dd 4
dd 1
db 'OpenBSD',0
dd 0


to brand the file as OpenBSD 

the 2nd one is the gas asm code i was working on .. i did some
checking on a simple C "hello world" code and found out this

$ gcc -o hellO hello.c
$ hellO
hello world
$ file hellO
hellO: ELF 32-bit LSB executable, Intel 80386, version 1, for OpenBSD,
dynamically linked (uses shared libs), not stripped

it seems that with assembly your always on your own =)



that solves it .. atleast for the mean time i can play around with
nasm .. and think of a way to make it work for gas

thanks for all the comments, support, etcetera :)

dee

On 7/2/05, Ted Hanna <[EMAIL PROTECTED]> wrote:
> mount info; no "noexec" option on my /etc/fstab too
> 
> $ mount
> /dev/wd0a on / type ffs (local)
> /dev/wd0d on /home type ffs (local, nodev, nosuid)
> /dev/wd0e on /tmp type ffs (local, nodev, nosuid)
> /dev/wd0g on /usr type ffs (local, nodev)
> /dev/wd0f on /var type ffs (local, nodev, nosuid)
> 
> 
> The code I'm trying to build using gas
> 
> $ cat hello.S
> .data
> 
> msg:
>  .ascii  "my OpenBSD is on GAS!\n"
>  len =3D . - 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
> 
> here's how i build it
> 
> $as -o hello.o hello.S
> $ld -s -o hello hello.o
> $hello
> sh: hello: Operation not permitted
> 
> it doesn't want to run at all =/ anyways... any help, comments will be
> very much appreciated
> 
> 
> 
> dee



Re: Gnu Assembler on Openbsd 3.7 "Operation not permitted"

2005-07-05 Thread Ted Hanna
julian, 

   can you please post how you do it on GAS? the work around I've got
is from nasm.. i tried to look into the "len=3D .-msg" you pointed out
.. same result though..


thanks,
dee

On 7/5/05, Julian Leyh <[EMAIL PROTECTED]> wrote:
> Ted Hanna <[EMAIL PROTECTED]> wrote:
> [...]
> >  len =3D . - msg
> [...]
> 
> see the =3D? maybe there is some character which shouldn't be there.
> try typing the whole program into a new file.
> 
> cu
> JRL
> 
> PS: the code works for me..
> 
> --
> If you don't remember something, it never existed...
> If you aren't remembered, you never existed...
> I don't quite understand what love is like... But if there
> was someone who liked me, I'd be happy.