This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Default 32 bit output


Domen Vrankar wrote:
--target=i386-elf
regards
kanishk

What about if I want to make target=i686 to output 32 bit executables? Is this even possible? Are there any benefits if you use target i686 instead of i386?


I'm sure I use:

CFLAGS="-m32" LDFLAGS="-m32" ./configure


There are two issues here. The issue of ABI, there is one 32bit ABI and one 64bit ABI on linux Intel IA32. The above flags will change that and maybe the suggested --target=i386-elf does too.



The i386 and i686 issue is more to do with code generation and optimization. Affecting load/store ordering, alignment, etc... but the ABI is the same.


I don't think there are any new instructions used when compiling for i686 on GCC, it just optimizes the code and generation for the execution flow and pipelines for that CPU better than a 386/486.

Which means the code won't SIGABORT on you and fail, it will just perform a little bit faster or slower.



AFAIK there is no way to mark the resulting executable by way of ELF magic numbers to only be usable on i686 onwards because the code makes use of new instructions.

Most applications which use say MMX perform an auto-detect on the CPU to decide the best routines to use and falling back to non-MMX versions.


Darryl



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]