I have a huge source code that works on PowerPC. I need to port it to ARM. But, ARM generates h/w exception on unaligned memory accesses. So, I want to find all the possible instances where the unaligned memory access exception could occur. I've considered the following options.
- Use -Wcast-align in gcc which would throw warnings for unaligned access.
- Make the PowerPC generate unaligned exception. For ARM, there is an option /proc/cpu/alignment by which the user can decide how to handle the exception. But, there is no such option for PowerPC.
My questions are,
- Is there a way to make the PowerPC generate unaligned memory access exception?
- Is there a better way to find out all occurences of unaligned memory access in the source code?