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

相關文章
相關標籤/搜索