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
6 2015-10-03 Max Filippov <jcmvbkbc@gmail.com>
8 * config.gcc (xtensa*-*-uclinux*): New configuration.
9 * config/xtensa/uclinux.h: New file.
10 * config/xtensa/uclinux.opt: New file.
13 * config.host (xtensa*-*-uclinux*): New configuration.
15 Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
17 Backported from: r228450
19 gcc/config.gcc | 5 ++++
20 gcc/config/xtensa/uclinux.h | 69 +++++++++++++++++++++++++++++++++++++++++++
21 gcc/config/xtensa/uclinux.opt | 32 ++++++++++++++++++++
22 libgcc/config.host | 5 ++++
23 4 files changed, 111 insertions(+)
24 create mode 100644 gcc/config/xtensa/uclinux.h
25 create mode 100644 gcc/config/xtensa/uclinux.opt
27 diff --git a/gcc/config.gcc b/gcc/config.gcc
28 index c52f5a8..56797bd 100644
31 @@ -2995,6 +2995,11 @@ xtensa*-*-linux*)
32 tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/linux.h"
33 tmake_file="${tmake_file} xtensa/t-xtensa"
36 + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/uclinux.h"
37 + tmake_file="${tmake_file} xtensa/t-xtensa"
38 + extra_options="${extra_options} xtensa/uclinux.opt"
41 tm_file="mn10300/mn10300.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h mn10300/linux.h"
43 diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h
45 index 0000000..4606020
47 +++ b/gcc/config/xtensa/uclinux.h
49 +/* Xtensa uClinux configuration.
50 + Derived from the configuration for GCC for Intel i386 running Linux.
51 + Copyright (C) 2001-2015 Free Software Foundation, Inc.
53 +This file is part of GCC.
55 +GCC is free software; you can redistribute it and/or modify it under
56 +the terms of the GNU General Public License as published by the Free
57 +Software Foundation; either version 3, or (at your option) any later
60 +GCC is distributed in the hope that it will be useful, but WITHOUT ANY
61 +WARRANTY; without even the implied warranty of MERCHANTABILITY or
62 +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
65 +You should have received a copy of the GNU General Public License
66 +along with GCC; see the file COPYING3. If not see
67 +<http://www.gnu.org/licenses/>. */
69 +#undef TARGET_OS_CPP_BUILTINS
70 +#define TARGET_OS_CPP_BUILTINS() \
73 + GNU_USER_TARGET_OS_CPP_BUILTINS (); \
74 + builtin_define ("__uClinux__"); \
78 +#undef SUBTARGET_CPP_SPEC
79 +#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
82 +#define SIZE_TYPE "unsigned int"
85 +#define PTRDIFF_TYPE "int"
88 +#define WCHAR_TYPE "long int"
90 +#undef WCHAR_TYPE_SIZE
91 +#define WCHAR_TYPE_SIZE 32
95 + "%{mtext-section-literals:--text-section-literals} \
96 + %{mno-text-section-literals:--no-text-section-literals} \
97 + %{mtarget-align:--target-align} \
98 + %{mno-target-align:--no-target-align} \
99 + %{mlongcalls:--longcalls} \
100 + %{mno-longcalls:--no-longcalls} \
101 + %{mauto-litpools:--auto-litpools} \
102 + %{mno-auto-litpools:--no-auto-litpools}"
105 +#define LINK_SPEC "%{!no-elf2flt:%{!elf2flt*:-elf2flt}}"
107 +#undef LOCAL_LABEL_PREFIX
108 +#define LOCAL_LABEL_PREFIX "."
110 +/* Always enable "-fpic" for Xtensa Linux. */
111 +#define XTENSA_ALWAYS_PIC 1
113 +#undef TARGET_LIBC_HAS_FUNCTION
114 +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
116 +#undef DBX_REGISTER_NUMBER
118 diff --git a/gcc/config/xtensa/uclinux.opt b/gcc/config/xtensa/uclinux.opt
120 index 0000000..95ef777
122 +++ b/gcc/config/xtensa/uclinux.opt
124 +; Xtensa uClinux options.
126 +; Copyright (C) 2015 Free Software Foundation, Inc.
128 +; This file is part of GCC.
130 +; GCC is free software; you can redistribute it and/or modify it under
131 +; the terms of the GNU General Public License as published by the Free
132 +; Software Foundation; either version 3, or (at your option) any later
135 +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
136 +; WARRANTY; without even the implied warranty of MERCHANTABILITY or
137 +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
140 +; You should have received a copy of the GNU General Public License
141 +; along with GCC; see the file COPYING3. If not see
142 +; <http://www.gnu.org/licenses/>.
144 +; See the GCC internals manual (options.texi) for a description of
145 +; this file's format.
147 +; Please try to keep this file in ASCII collating order.
153 +Driver JoinedOrMissing
155 +; This comment is to ensure we retain the blank line above.
156 diff --git a/libgcc/config.host b/libgcc/config.host
157 index 2c64756..2ee92c1 100644
158 --- a/libgcc/config.host
159 +++ b/libgcc/config.host
160 @@ -1295,6 +1295,11 @@ xtensa*-*-linux*)
161 tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc"
162 md_unwind_header=xtensa/linux-unwind.h
165 + tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc"
166 + md_unwind_header=xtensa/linux-unwind.h
167 + extra_parts="$extra_parts crtbeginS.o crtbeginT.o crtendS.o"
170 # Don't need crtbeginT.o from *-*-linux* default.
171 extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"