800-arm-bigendian.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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-3.4.1-dist/gcc/config/arm/linux-elf.h
  5. +++ gcc-3.4.1/gcc/config/arm/linux-elf.h
  6. @@ -30,17 +30,34 @@
  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. /* Default is to use APCS-32 mode. */
  24. #undef TARGET_DEFAULT
  25. -#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
  26. +#define TARGET_DEFAULT \
  27. + ( ARM_FLAG_APCS_32 | \
  28. + ARM_FLAG_MMU_TRAPS | \
  29. + 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", "mapcs-32", "mno-thumb-interwork" }
  36. + { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
  37. #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
  38. @@ -101,7 +118,7 @@
  39. %{rdynamic:-export-dynamic} \
  40. %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
  41. -X \
  42. - %{mbig-endian:-EB}" \
  43. + %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
  44. SUBTARGET_EXTRA_LINK_SPEC
  45. #endif
  46. --- gcc-3.4.1-dist/gcc/config.gcc
  47. +++ gcc-3.4.1/gcc/config.gcc
  48. @@ -672,6 +672,11 @@
  49. ;;
  50. arm*-*-linux*) # ARM GNU/Linux with ELF
  51. 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"
  52. + case $target in
  53. + arm*b-*)
  54. + tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
  55. + ;;
  56. + esac
  57. tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
  58. extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
  59. gnu_ld=yes