https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65255
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- arm-* defaults to earlier arm than v7 which does not have atomics in the ISA. Your native compiler most likely defaulted to armv7 which uses the atomic instructions directly. Can you provide the output of gcc -v that you are running natively and most likely see the default cpu/arch that is being selected.