I current use x86-64 platform linux. My question is, can I use the default compiler to compile i386 program with option -m32 instead of building a single cross-compiler?
Best Regards
cross compiler question
Re: cross compiler question
You can compile 32-bit applications that way, but assuming you want to do OS development you'd want a cross compiler whether you were targeting 64 or 32-bit.
Re: cross compiler question
That means I need cross compiler if I do os development no metter what platform I am targeting? Ever it's same as host platform(my case is x86-64)?
Thanks in advance
Thanks in advance
Re: cross compiler question
I read a article "Why do I need a Cross Compiler?" host on wiki. Refer to below section
Thanks in advance
Do that can answer my previous question as "yes"?If you are developing on 64-bit Linux, then you will get a response such as 'x86_64-unknown-linux-gnu'. This means that the compiler thinks it is creating code for Linux. If you use this gcc to build your kernel, it will use your system libraries, headers, the Linux libgcc, and it will make a lot of problematic Linux assumptions. If you use a cross-compiler such as i585-elf-gcc, then you get a response back such as 'i686-elf' that means the compiler knows it is doing something else and you can avoid a lot of problems easily and properly.
Thanks in advance
Last edited by liangxiao on Wed Aug 26, 2015 4:31 am, edited 2 times in total.
-
- Member
- Posts: 5588
- Joined: Mon Mar 25, 2013 7:01 pm