800-arm-bigendian.patch 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. Index: gcc-4.1.1/gcc/config/arm/linux-elf.h
  5. ===================================================================
  6. --- gcc-4.1.1.orig/gcc/config/arm/linux-elf.h
  7. +++ gcc-4.1.1/gcc/config/arm/linux-elf.h
  8. @@ -28,19 +28,33 @@
  9. #undef TARGET_VERSION
  10. #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
  11. +/*
  12. + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
  13. + * (big endian) configurations.
  14. + */
  15. +#if TARGET_BIG_ENDIAN_DEFAULT
  16. +#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
  17. +#define TARGET_ENDIAN_OPTION "mbig-endian"
  18. +#define TARGET_LINKER_EMULATION "armelfb_linux"
  19. +#else
  20. +#define TARGET_ENDIAN_DEFAULT 0
  21. +#define TARGET_ENDIAN_OPTION "mlittle-endian"
  22. +#define TARGET_LINKER_EMULATION "armelf_linux"
  23. +#endif
  24. +
  25. #undef TARGET_DEFAULT_FLOAT_ABI
  26. #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
  27. #undef TARGET_DEFAULT
  28. -#define TARGET_DEFAULT (0)
  29. +#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
  30. #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
  31. -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
  32. +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
  33. #undef MULTILIB_DEFAULTS
  34. #define MULTILIB_DEFAULTS \
  35. - { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
  36. + { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
  37. /* Now we define the strings used to build the spec file. */
  38. #undef LIB_SPEC
  39. @@ -61,7 +75,7 @@
  40. %{rdynamic:-export-dynamic} \
  41. %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \
  42. -X \
  43. - %{mbig-endian:-EB}" \
  44. + %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
  45. SUBTARGET_EXTRA_LINK_SPEC
  46. #undef LINK_SPEC
  47. Index: gcc-4.1.1/gcc/config.gcc
  48. ===================================================================
  49. --- gcc-4.1.1.orig/gcc/config.gcc
  50. +++ gcc-4.1.1/gcc/config.gcc
  51. @@ -672,6 +672,11 @@ arm*-*-netbsd*)
  52. ;;
  53. arm*-*-linux*) # ARM GNU/Linux with ELF
  54. tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
  55. + case $target in
  56. + arm*b-*)
  57. + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
  58. + ;;
  59. + esac
  60. tmake_file="${tmake_file} t-linux arm/t-arm"
  61. case ${target} in
  62. arm*-*-linux-gnueabi)
  63. Index: gcc-4.1.1/gcc/config/arm/linux-eabi.h
  64. ===================================================================
  65. --- gcc-4.1.1.orig/gcc/config/arm/linux-eabi.h
  66. +++ gcc-4.1.1/gcc/config/arm/linux-eabi.h
  67. @@ -20,6 +20,17 @@
  68. the Free Software Foundation, 51 Franklin Street, Fifth Floor,
  69. Boston, MA 02110-1301, USA. */
  70. +/*
  71. + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
  72. + * (big endian) configurations.
  73. + */
  74. +#undef TARGET_LINKER_EMULATION
  75. +#if TARGET_BIG_ENDIAN_DEFAULT
  76. +#define TARGET_LINKER_EMULATION "armelfb_linux_eabi"
  77. +#else
  78. +#define TARGET_LINKER_EMULATION "armelf_linux_eabi"
  79. +#endif
  80. +
  81. /* On EABI GNU/Linux, we want both the BPABI builtins and the
  82. GNU/Linux builtins. */
  83. #undef TARGET_OS_CPP_BUILTINS
  84. @@ -48,7 +59,7 @@
  85. #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
  86. #undef SUBTARGET_EXTRA_LINK_SPEC
  87. -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi"
  88. +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION
  89. /* Use ld-linux.so.3 so that it will be possible to run "classic"
  90. GNU/Linux binaries on an EABI system. */
  91. Index: gcc-4.1.1/gcc/config/arm/bpabi.h
  92. ===================================================================
  93. --- gcc-4.1.1.orig/gcc/config/arm/bpabi.h
  94. +++ gcc-4.1.1/gcc/config/arm/bpabi.h
  95. @@ -33,9 +33,19 @@
  96. #undef FPUTYPE_DEFAULT
  97. #define FPUTYPE_DEFAULT FPUTYPE_VFP
  98. +/*
  99. + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
  100. + * (big endian) configurations.
  101. + */
  102. +#if TARGET_BIG_ENDIAN_DEFAULT
  103. +#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
  104. +#else
  105. +#define TARGET_ENDIAN_DEFAULT 0
  106. +#endif
  107. +
  108. /* EABI targets should enable interworking by default. */
  109. #undef TARGET_DEFAULT
  110. -#define TARGET_DEFAULT MASK_INTERWORK
  111. +#define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT)
  112. /* The ARM BPABI functions return a boolean; they use no special
  113. calling convention. */