According to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58938, configure GCC with '-with-arch=armv7-a' should do the job (setting __GCC_ATOMIC_INT_LOCK_FREE / ATOMIC_INT_LOCK_FREE to 2), IIUC.

Forgot to mention that use -with-arch=armv7-a (or whatever ISA on which atomic_int is always lock free) only if your target supports it, otherwise GCC 7.1 may be the only choice.