So, I've got something put together. I think it should be fairly scalable. As a test I've thrown in some ARM overrides.
See git://repo.or.cz/gcc/rth.git rth/libatomic which is a gcc tree with a libatomic subdir. Comments welcome. Andrew, didn't you say you had some code as well, but didn't want to argue with autofoo? r~