GCC -arch i386 versus -m32?

Discussion in 'Mac Basics and Help' started by sam_hansen77, May 13, 2017.

  1. sam_hansen77 macrumors newbie

    Joined:
    May 13, 2017
    #1
    Hi. When using gcc, what is the difference between -arch i386 versus -m32?
     
  2. cqexbesd macrumors regular

    Joined:
    Jun 4, 2009
    #2
    On Intel processors -m32 says generate code for 32 bit processors (which would also run on 64 bit processors though caution is advised if mixing 32 and 64 bit code). To quote the docs "The -m32 option sets int, long, and pointer types to 32 bits, and generates code that runs on any i386 system."

    https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/x86-Options.html#index-m32-5

    I assume you meant -march i386 as the other part of the question. That means generate code specifically for the 386 processor. This code may not run on any other sort of processor (but is hopefully more efficient on the i386 than it would be otherwise). My guess is this code _will_ run on newer processors as well, but there are no guarantees and I haven't tried it myself. As the 386 was a 32 bit processor I guess it implies -m32 as well.

    https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/x86-Options.html#index-march-12
     

Share This Page