800-arm-bigendian.patch 2.1 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.0.3/gcc/config/arm/linux-elf.h
  5. +++ gcc-4.0.3/gcc/config/arm/linux-elf.h
  6. @@ -31,19 +31,33 @@
  7. /* Do not assume anything about header files. */
  8. #define NO_IMPLICIT_EXTERN_C
  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 ARM_FLAG_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. /* The GNU C++ standard library requires that these macros be defined. */
  36. #undef CPLUSPLUS_CPP_SPEC
  37. @@ -90,7 +104,7 @@
  38. %{rdynamic:-export-dynamic} \
  39. %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
  40. -X \
  41. - %{mbig-endian:-EB}" \
  42. + %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
  43. SUBTARGET_EXTRA_LINK_SPEC
  44. #define TARGET_OS_CPP_BUILTINS() \
  45. --- gcc-4.0.3/gcc/config.gcc
  46. +++ gcc-4.0.3/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 arm/aout.h arm/arm.h"
  51. + case $target in
  52. + arm*b-*)
  53. + tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
  54. + ;;
  55. + esac
  56. tmake_file="${tmake_file} arm/t-arm arm/t-linux"
  57. extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
  58. gnu_ld=yes