((43 .65 / 22 ) + (76.34 * 3.1)) / ( (12.34 * 6 ) - (140.2 / 94.21) )
1 .section .data 2 value1: 3 .float 43.65 4 value2: 5 .int 22 6 value3: 7 .float 76.34 8 value4: 9 .float 3.1 10 value5: 11 .float 12.34 12 value6: 13 .int 6 14 value7: 15 .float 140.2 16 value8: 17 .float 94.21 18 output: 19 .asciz "The result is %f " 20 .section .text 21 .globl _start 22 _start: 23 nop 24 finit 25 flds value1 26 flds value2 27 flds value3 28 flds value4 29 fmul %st(1), %st(0) 30 fmul %st(2), %st(0) 31 flds value5 32 fmul value6 33 flds value7 34 flds value8 35 fdivrp 36 fsubr %st(1), %st(0) 37 fdivr %st(2), %st(0) 38 subl $8, %esp 39 pushl $output 40 call printf 41 add $12, %esp 42 pushl $0 43 call exit
as -o yunsuan.o yunsuan.s yunsuan.s: Assembler messages: yunsuan.s:40: 错误: invalid instruction suffix for `push' yunsuan.s:43: 错误: invalid instruction suffix for `push'
错误原因是,在64位系统和32位系统的as命令对于某些汇编指令的处理支持不一样造成的。
在文件.s中,包含指令:pushl %ebp,该指令在64位系统下就编译不过
决方法:在callee.s中,在代码头部添加.code32即可