making GCC generate <i686 code

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

making GCC generate <i686 code

Post by NickJohnson »

I made some modifications to various functions within my kernel, and now there is an error in Bochs when I run it:

CMOV_GdEd: -enable-cpu-level=6 required

I think this means I had to compile Bochs to emulate an i686 processor in order to get some specific instruction to work. When I compile my kernel with TCC instead of GCC, everything works perfectly. So I think GCC is making i686 optimizations on my code, which I don't want. I have no other optimizations, except for -fomit-frame-pointer on all code; removing this flag does nothing to fix things. My current version of GCC is i686-pc-linux-gnu 4.3.2. How can I make GCC restrict it's instruction set to an i386/i486 instead of an i686?

Or am I misinterpreting this error?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: making GCC generate <i686 code

Post by Combuster »

"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: making GCC generate <i686 code

Post by NickJohnson »

Okay, I really needed to RTFM. I just recompiled with all -march=i386 and it works now.

However, should I really be using a cross compiler for any reason?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: making GCC generate <i686 code

Post by Combuster »

The advantages of a crosscompiler are mentioned in the article.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply