800-arm_v5te_no_ldrd_strd.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. commit b050f87d13b5dc7ed82feb9a90f4529de58bdf25
  2. Author: Felix Fietkau <nbd@openwrt.org>
  3. Date: Wed Feb 19 19:20:10 2014 +0000
  4. gcc: prevent the use of LDRD/STRD on ARMv5TE
  5. These instructions are for 64-bit load/store. On ARMv5TE, the CPU
  6. requires addresses to be aligned to 64-bit. When misaligned, behavior is
  7. undefined (effectively either loads the same word twice on LDRD, or
  8. corrupts surrounding memory on STRD).
  9. On ARMv6 and newer, unaligned access is safe.
  10. Removing these instructions for ARMv5TE is necessary, because GCC
  11. ignores alignment information in pointers and does unsafe optimizations
  12. that have shown up as bugs in various places.
  13. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  14. SVN-Revision: 39638
  15. --- a/gcc/config/arm/arm.h
  16. +++ b/gcc/config/arm/arm.h
  17. @@ -150,7 +150,7 @@ extern tree arm_fp16_type_node;
  18. /* Thumb-1 only. */
  19. #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
  20. -#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \
  21. +#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
  22. && !TARGET_THUMB1)
  23. #define TARGET_CRC32 (arm_arch_crc)