874-xtensa-add-uclinux-support.patch 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. From 70c2cb98fb129b4766b5da0f945dc41fd568c77a Mon Sep 17 00:00:00 2001
  2. From: Max Filippov <jcmvbkbc@gmail.com>
  3. Date: Sat, 22 Aug 2015 08:44:26 +0300
  4. Subject: [PATCH] xtensa: add uclinux support
  5. 2015-10-03 Max Filippov <jcmvbkbc@gmail.com>
  6. gcc/
  7. * config.gcc (xtensa*-*-uclinux*): New configuration.
  8. * config/xtensa/uclinux.h: New file.
  9. * config/xtensa/uclinux.opt: New file.
  10. libgcc/
  11. * config.host (xtensa*-*-uclinux*): New configuration.
  12. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  13. ---
  14. Backported from: r228450
  15. gcc/config.gcc | 5 ++++
  16. gcc/config/xtensa/uclinux.h | 69 +++++++++++++++++++++++++++++++++++++++++++
  17. gcc/config/xtensa/uclinux.opt | 32 ++++++++++++++++++++
  18. libgcc/config.host | 5 ++++
  19. 4 files changed, 111 insertions(+)
  20. create mode 100644 gcc/config/xtensa/uclinux.h
  21. create mode 100644 gcc/config/xtensa/uclinux.opt
  22. diff --git a/gcc/config.gcc b/gcc/config.gcc
  23. index c52f5a8..56797bd 100644
  24. --- a/gcc/config.gcc
  25. +++ b/gcc/config.gcc
  26. @@ -2995,6 +2995,11 @@ xtensa*-*-linux*)
  27. tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/linux.h"
  28. tmake_file="${tmake_file} xtensa/t-xtensa"
  29. ;;
  30. +xtensa*-*-uclinux*)
  31. + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/uclinux.h"
  32. + tmake_file="${tmake_file} xtensa/t-xtensa"
  33. + extra_options="${extra_options} xtensa/uclinux.opt"
  34. + ;;
  35. am33_2.0-*-linux*)
  36. tm_file="mn10300/mn10300.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h mn10300/linux.h"
  37. gas=yes gnu_ld=yes
  38. diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h
  39. new file mode 100644
  40. index 0000000..4606020
  41. --- /dev/null
  42. +++ b/gcc/config/xtensa/uclinux.h
  43. @@ -0,0 +1,69 @@
  44. +/* Xtensa uClinux configuration.
  45. + Derived from the configuration for GCC for Intel i386 running Linux.
  46. + Copyright (C) 2001-2015 Free Software Foundation, Inc.
  47. +
  48. +This file is part of GCC.
  49. +
  50. +GCC is free software; you can redistribute it and/or modify it under
  51. +the terms of the GNU General Public License as published by the Free
  52. +Software Foundation; either version 3, or (at your option) any later
  53. +version.
  54. +
  55. +GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  56. +WARRANTY; without even the implied warranty of MERCHANTABILITY or
  57. +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  58. +for more details.
  59. +
  60. +You should have received a copy of the GNU General Public License
  61. +along with GCC; see the file COPYING3. If not see
  62. +<http://www.gnu.org/licenses/>. */
  63. +
  64. +#undef TARGET_OS_CPP_BUILTINS
  65. +#define TARGET_OS_CPP_BUILTINS() \
  66. + do \
  67. + { \
  68. + GNU_USER_TARGET_OS_CPP_BUILTINS (); \
  69. + builtin_define ("__uClinux__"); \
  70. + } \
  71. + while (0)
  72. +
  73. +#undef SUBTARGET_CPP_SPEC
  74. +#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
  75. +
  76. +#undef SIZE_TYPE
  77. +#define SIZE_TYPE "unsigned int"
  78. +
  79. +#undef PTRDIFF_TYPE
  80. +#define PTRDIFF_TYPE "int"
  81. +
  82. +#undef WCHAR_TYPE
  83. +#define WCHAR_TYPE "long int"
  84. +
  85. +#undef WCHAR_TYPE_SIZE
  86. +#define WCHAR_TYPE_SIZE 32
  87. +
  88. +#undef ASM_SPEC
  89. +#define ASM_SPEC \
  90. + "%{mtext-section-literals:--text-section-literals} \
  91. + %{mno-text-section-literals:--no-text-section-literals} \
  92. + %{mtarget-align:--target-align} \
  93. + %{mno-target-align:--no-target-align} \
  94. + %{mlongcalls:--longcalls} \
  95. + %{mno-longcalls:--no-longcalls} \
  96. + %{mauto-litpools:--auto-litpools} \
  97. + %{mno-auto-litpools:--no-auto-litpools}"
  98. +
  99. +#undef LINK_SPEC
  100. +#define LINK_SPEC "%{!no-elf2flt:%{!elf2flt*:-elf2flt}}"
  101. +
  102. +#undef LOCAL_LABEL_PREFIX
  103. +#define LOCAL_LABEL_PREFIX "."
  104. +
  105. +/* Always enable "-fpic" for Xtensa Linux. */
  106. +#define XTENSA_ALWAYS_PIC 1
  107. +
  108. +#undef TARGET_LIBC_HAS_FUNCTION
  109. +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
  110. +
  111. +#undef DBX_REGISTER_NUMBER
  112. +
  113. diff --git a/gcc/config/xtensa/uclinux.opt b/gcc/config/xtensa/uclinux.opt
  114. new file mode 100644
  115. index 0000000..95ef777
  116. --- /dev/null
  117. +++ b/gcc/config/xtensa/uclinux.opt
  118. @@ -0,0 +1,32 @@
  119. +; Xtensa uClinux options.
  120. +
  121. +; Copyright (C) 2015 Free Software Foundation, Inc.
  122. +;
  123. +; This file is part of GCC.
  124. +;
  125. +; GCC is free software; you can redistribute it and/or modify it under
  126. +; the terms of the GNU General Public License as published by the Free
  127. +; Software Foundation; either version 3, or (at your option) any later
  128. +; version.
  129. +;
  130. +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  131. +; WARRANTY; without even the implied warranty of MERCHANTABILITY or
  132. +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  133. +; for more details.
  134. +;
  135. +; You should have received a copy of the GNU General Public License
  136. +; along with GCC; see the file COPYING3. If not see
  137. +; <http://www.gnu.org/licenses/>.
  138. +
  139. +; See the GCC internals manual (options.texi) for a description of
  140. +; this file's format.
  141. +
  142. +; Please try to keep this file in ASCII collating order.
  143. +
  144. +elf2flt
  145. +Driver
  146. +
  147. +elf2flt=
  148. +Driver JoinedOrMissing
  149. +
  150. +; This comment is to ensure we retain the blank line above.
  151. diff --git a/libgcc/config.host b/libgcc/config.host
  152. index 2c64756..2ee92c1 100644
  153. --- a/libgcc/config.host
  154. +++ b/libgcc/config.host
  155. @@ -1295,6 +1295,11 @@ xtensa*-*-linux*)
  156. tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc"
  157. md_unwind_header=xtensa/linux-unwind.h
  158. ;;
  159. +xtensa*-*-uclinux*)
  160. + tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc"
  161. + md_unwind_header=xtensa/linux-unwind.h
  162. + extra_parts="$extra_parts crtbeginS.o crtbeginT.o crtendS.o"
  163. + ;;
  164. am33_2.0-*-linux*)
  165. # Don't need crtbeginT.o from *-*-linux* default.
  166. extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
  167. --
  168. 1.8.1.4