800-arm-bigendian.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. By Lennert Buytenhek <buytenh@wantstofly.org>
  2. Adds support for arm*b-linux* big-endian ARM targets
  3. See http://gcc.gnu.org/PR16350
  4. --- gcc-4.1.0/gcc/config/arm/linux-elf.h
  5. +++ gcc-4.1.0/gcc/config/arm/linux-elf.h
  6. @@ -28,19 +28,33 @@
  7. #undef TARGET_VERSION
  8. #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
  9. +/*
  10. + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
  11. + * (big endian) configurations.
  12. + */
  13. +#if TARGET_BIG_ENDIAN_DEFAULT
  14. +#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
  15. +#define TARGET_ENDIAN_OPTION "mbig-endian"
  16. +#define TARGET_LINKER_EMULATION "armelfb_linux"
  17. +#else
  18. +#define TARGET_ENDIAN_DEFAULT 0
  19. +#define TARGET_ENDIAN_OPTION "mlittle-endian"
  20. +#define TARGET_LINKER_EMULATION "armelf_linux"
  21. +#endif
  22. +
  23. #undef TARGET_DEFAULT_FLOAT_ABI
  24. #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
  25. #undef TARGET_DEFAULT
  26. -#define TARGET_DEFAULT (0)
  27. +#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
  28. #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
  29. -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
  30. +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
  31. #undef MULTILIB_DEFAULTS
  32. #define MULTILIB_DEFAULTS \
  33. - { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
  34. + { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
  35. /* Now we define the strings used to build the spec file. */
  36. #undef LIB_SPEC
  37. @@ -61,7 +75,7 @@
  38. %{rdynamic:-export-dynamic} \
  39. %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \
  40. -X \
  41. - %{mbig-endian:-EB}" \
  42. + %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
  43. SUBTARGET_EXTRA_LINK_SPEC
  44. #undef LINK_SPEC
  45. --- gcc-4.1.0/gcc/config.gcc
  46. +++ gcc-4.1.0/gcc/config.gcc
  47. @@ -672,6 +672,11 @@
  48. ;;
  49. arm*-*-linux*) # ARM GNU/Linux with ELF
  50. tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
  51. + case $target in
  52. + arm*b-*)
  53. + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
  54. + ;;
  55. + esac
  56. tmake_file="${tmake_file} t-linux arm/t-arm"
  57. case ${target} in
  58. arm*-*-linux-gnueabi)