Difference between --target=i386 and i686

Jim Wilson jimw@sifive.com
Sat Feb 22 00:58:00 GMT 2020

On Fri, Feb 21, 2020 at 9:38 AM J.W. Jagersma <jwjagersma@gmail.com> wrote:
> > Besides the performance loss, i386 doesn't have cmpxchg which means
> > atomic support will be a problem.  Otherwise, it will probably work.
> I did notice that using i386, my program doesn't link at -O0 due to
> undefined references to __atomic_* builtins. Somehow it works at -O1
> and above. It seems the only atomic operations I use are compiled to
> 'lock add/sub' instructions.

Atomics are probably inline expanded with optimization.  There is a
libatomic library you can link with, -latomic, that should implement
all atomics that aren't inline expanded.  But I'm not sure exactly how
this works with a i386 toolchain given that cmpxchg is missing.


More information about the Gcc-help mailing list