x86_64上编译32bit汇编指令报错,解决方法

[root@A01-R06-I180-93 power]# as power.s -o power.o
power.s: Assembler messages:
power.s:12: Error: invalid instruction suffix for `push'git

 

  1. Add .code32 to the top of your assembly code
  2. Assemble with the --32 flag
  3. Link with the -m elf_i386 flag

 

https://github.com/agam/LearningAssembly/blob/master/power.sgithub

 

运行脚本:code

#!/bin/sh
as --32 $1.s -o $1
ld -melf_i386 $1.o -o $1
./$1
echo $?it

相关文章
相关标签/搜索