From: Yvan Roux [yvan.roux@linaro.org] Sent: 25 November 2012 19:51 To: Ramana Radhakrishnan Cc: linaro-toolchain@lists.linaro.org Subject: Re: Atomic builtins questions
That is correct. The addresses need to be aligned as per the restrictions in the architecture. Yes we could have an issue but software writers need to deal with it because IIUC you either have a huge performance penalty (x86 / lock prefix) or correctness issues (ARM, Powerpc) .
Ok thanks, I buy the performance argument and I found on the wiki page below that these issues will be treated in the GCC/libatomic in 4.9 release.
It's a correctness issue on ARM. It won't work till the architecture changes. If it isn't correct, there's no point being fast :) . Taking off list as I wasn't a 100% sure what you meant there.
If you really need something like that you'll need a library call and the library call deals with it by doing an atomic access of the correspondingly rounded up size from an appropriately rounded down address.
regards, Ramana