800-arm-bigendian.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. diff -urN gcc-3.4.1-dist/gcc/config/arm/linux-elf.h gcc-3.4.1/gcc/config/arm/linux-elf.h
  5. --- gcc-3.4.1-dist/gcc/config/arm/linux-elf.h 2004-08-16 16:01:50.000000000 -0500
  6. +++ gcc-3.4.1/gcc/config/arm/linux-elf.h 2004-08-16 15:43:40.000000000 -0500
  7. @@ -30,17 +30,34 @@
  8. /* Do not assume anything about header files. */
  9. #define NO_IMPLICIT_EXTERN_C
  10. +/*
  11. + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
  12. + * (big endian) configurations.
  13. + */
  14. +#if TARGET_BIG_ENDIAN_DEFAULT
  15. +#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
  16. +#define TARGET_ENDIAN_OPTION "mbig-endian"
  17. +#define TARGET_LINKER_EMULATION "armelfb_linux"
  18. +#else
  19. +#define TARGET_ENDIAN_DEFAULT 0
  20. +#define TARGET_ENDIAN_OPTION "mlittle-endian"
  21. +#define TARGET_LINKER_EMULATION "armelf_linux"
  22. +#endif
  23. +
  24. /* Default is to use APCS-32 mode. */
  25. #undef TARGET_DEFAULT
  26. -#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
  27. +#define TARGET_DEFAULT \
  28. + ( ARM_FLAG_APCS_32 | \
  29. + ARM_FLAG_MMU_TRAPS | \
  30. + TARGET_ENDIAN_DEFAULT )
  31. #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
  32. -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
  33. +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
  34. #undef MULTILIB_DEFAULTS
  35. #define MULTILIB_DEFAULTS \
  36. - { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
  37. + { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
  38. #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
  39. @@ -101,7 +118,7 @@
  40. %{rdynamic:-export-dynamic} \
  41. %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
  42. -X \
  43. - %{mbig-endian:-EB}" \
  44. + %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
  45. SUBTARGET_EXTRA_LINK_SPEC
  46. #endif
  47. diff -urN gcc-3.4.1-dist/gcc/config.gcc gcc-3.4.1/gcc/config.gcc
  48. --- gcc-3.4.1-dist/gcc/config.gcc 2004-08-16 16:01:50.000000000 -0500
  49. +++ gcc-3.4.1/gcc/config.gcc 2004-08-16 16:01:25.000000000 -0500
  50. @@ -672,6 +672,11 @@
  51. ;;
  52. arm*-*-linux*) # ARM GNU/Linux with ELF
  53. 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"
  54. + case $target in
  55. + arm*b-*)
  56. + tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
  57. + ;;
  58. + esac
  59. tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
  60. extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
  61. gnu_ld=yes