I'm about to learn x86 assembly on os x 10.6 let me know how compile..plz

Posted by kevin choung on Stack Overflow See other posts from Stack Overflow or by kevin choung
Published on 2010-05-02T05:49:04Z Indexed on 2010/05/02 5:57 UTC
Read the original article Hit count: 285

Filed under:
|

hello~ I'm about to learn x86 assembly language on mac os x... I'm using as instruction to compile assembly file in commend window. but I have several errors.. and I don't know how I can get through..

here is the errors and my assembly code.. which is quite simple.

**ung-mi-lims-macbook-pro:pa2 ungmi$ as swap.s
swap.s:16:Unknown pseudo-op: .type
swap.s:16:Rest of line ignored. 1st junk character valued 115 (s).
swap.s:19:suffix or operands invalid for `push'
swap.s:46:suffix or operands invalid for `pop'
ung-mi-lims-macbook-pro:pa2 ungmi$** 

and the source is

.text
        .align 4
.globl  swap
        .type swap,@function

swap:
        pushl   %ebp
        movl    %esp, %ebp

        movl    %ebp, %esp
        popl    %ebp
        ret

and I searched some solution which is I have to put -arch i386 than

**ung-mi-lims-macbook-pro:pa2 ungmi$ as -arch i386 swap.s
swap.s:16:Unknown pseudo-op: .type
swap.s:16:Rest of line ignored. 1st junk character valued 115 (s).
ung-mi-lims-macbook-pro:pa2 ungmi$** 

could you help me out.. just let me know what I need to compile assembly file.. I have xcode already.. and I'd rather to do this with commend window..and vi editor..

I will be waiting for your answer... plz help me.

© Stack Overflow or respective owner

Related posts about x86

Related posts about assembly