I was busying studying my Linux , who called Ubuntu.Assemble compiled is interesting. I has known to use the ORDER::AS to compile the AT&T and ORDER ::nasm to compile the Intel ASSEMBLE,since I use learnt the program.
But ,how to use the Assemble to insert the C program ?I read many book borrowed from my school library.It is a joke what the same as many books.Copy the book from another book.And more ,some as written one sentence just one line.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
OFFTEN SHOW ERROR:
ERROR::ONE
inline.c: 在函数‘main’中:
inline.c:9:1: 错误: expected ‘)’ before ‘:’ token
solution:
(MAYBE HERE::)__asm__ __volatile__
[
attention:: _ _ asm _ _ (space) _ _ volatile _ _ (Enlarge , is RIGHT)
_asm_ _ volatile_ (maybe it is your writed,is WRONG)
]
ERROR::TWO
inline.c: Assembler messages:
inline.c:6: Error: junk at end of line, first unrecognized character is `\'
solution:
[
"movl %1,%%eax;\\n\\t" (WRONG)
"movl %1,%%eax;\n\t" (RIGHT)
OR
"movl %1,%%eax;\n\r"(RIGHT)
]
ERROR:THREE
inline.c: 在函数‘main’中:
inline.c:14:3: 警告: 隐式声明与内建函数‘printf’不兼容 [默认启用]
[
whether you added the head C file ::stdio.h
]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Now ,I copy some from the Book and Internet ,and integrate what I do test on my computer.
PIC As following:
---------------------
inline.c
---------------------
[this code can be run]
you can add::return 0 at the tail of the program.
[
order :
1、gcc -S inline.c
#produce a file called inline.s written by assemble you can use
[ cat -n inline.s]
to show this file
2、gcc -o inline inline.s
3、./inline
#show this result as you see.
]
Order show as the PICTURE,YOU SEE.
Thank you for you read.
阅读(1101) | 评论(0) | 转发(0) |