0003-fix-arm-detection.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. Improve the ARM detection to work on Thumb-only architecture
  2. The ARM-specific assembly code doesn't build on Thumb-only
  3. architectures such as ARMv7-M, but the configure script assumes that
  4. if the host tuple is arm*, then it can build and use the ARM optimized
  5. code.
  6. This patch improves the configure.ac detection logic, by building one
  7. of the instruction of the optimized assembly code, and using this to
  8. decide whether or not the optimizations should be enabled.
  9. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  10. Index: b/configure.ac
  11. ===================================================================
  12. --- a/configure.ac
  13. +++ b/configure.ac
  14. @@ -101,8 +101,10 @@
  15. alpha*)
  16. AC_DEFINE([ARCH_ALPHA],,[alpha architecture]);;
  17. arm*)
  18. - arm_conditional=:
  19. - AC_DEFINE([ARCH_ARM],,[ARM architecture]);;
  20. + AC_TRY_LINK([], [asm(".syntax divided\nstmfd sp!,{r4-r11,lr}")],
  21. + [AC_DEFINE([ARCH_ARM],,[ARM architecture])
  22. + use_arm_optimization=yes],
  23. + [use_arm_optimization=no])
  24. esac
  25. elif test x"$CC" = x"tendracc"; then
  26. dnl TenDRA portability checking compiler
  27. @@ -122,7 +124,7 @@
  28. esac
  29. fi
  30. -AM_CONDITIONAL(ARCH_ARM, ${arm_conditional})
  31. +AM_CONDITIONAL(ARCH_ARM, test "${use_arm_optimization}" = "yes")
  32. dnl Checks for libtool - this must be done after we set cflags
  33. AC_LIBTOOL_WIN32_DLL