2
1

800-arm-bigendian.patch 2.2 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.2.0/gcc/config/arm/linux-elf.h
  5. +++ gcc-4.2.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_DYNAMIC_LINKER "} \
  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.2.0/gcc/config.gcc.orig 2006-09-22 14:53:41.000000000 +0200
  46. +++ gcc-4.2.0/gcc/config.gcc 2006-09-25 10:45:21.000000000 +0200
  47. @@ -696,6 +696,11 @@
  48. tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
  49. tmake_file="${tmake_file} t-linux arm/t-arm"
  50. case ${target} in
  51. + arm*b-*)
  52. + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
  53. + ;;
  54. + esac
  55. + case ${target} in
  56. arm*-*-linux-*eabi)
  57. tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
  58. tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"