Unsupported x86-64 instruction set error when compiling C file

前端 未结 3 2286
清歌不尽
清歌不尽 2021-02-15 00:05

I am trying to follow the tutorials in this link.

When I get down to the part where I start making a test.c file, I try to run the first compilation line.



        
3条回答
  •  粉色の甜心
    2021-02-15 00:27

    in fact add -m32 you can keep -march=i686 ...

    gcc -c -g -Os -march=i686 -m32 -ffreestanding -Wall -Werror test.c -o test.o
    

    works

    gcc -c -g -Os -march=i686 -m16 -ffreestanding -Wall -Werror test.c -o test.o
    

    works

    gcc -c -g -Os -march=i686 -m64 -ffreestanding -Wall -Werror test.c -o test.o
    

    fails with ;

    test.c:1:0: error: CPU you selected does not support x86-64 instruction set asm(".code16\n");

提交回复
热议问题