Reimplemented atomic_get_and_set in C++.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>

* C++ code written by pdziepak.
Enable C++11 for all ARM targets, not just beagle.

* Also clean up the flags definitions in the beagle target to avoid
repeating the flags 3 times.