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 Index: b/gcc/config.gcc
28 ===================================================================
31 @@ -2871,6 +2871,11 @@
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 Index: b/gcc/config/xtensa/uclinux.h
44 ===================================================================
46 +++ b/gcc/config/xtensa/uclinux.h
48 +/* Xtensa uClinux configuration.
49 + Derived from the configuration for GCC for Intel i386 running Linux.
50 + Copyright (C) 2001-2015 Free Software Foundation, Inc.
52 +This file is part of GCC.
54 +GCC is free software; you can redistribute it and/or modify it under
55 +the terms of the GNU General Public License as published by the Free
56 +Software Foundation; either version 3, or (at your option) any later
59 +GCC is distributed in the hope that it will be useful, but WITHOUT ANY
60 +WARRANTY; without even the implied warranty of MERCHANTABILITY or
61 +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
64 +You should have received a copy of the GNU General Public License
65 +along with GCC; see the file COPYING3. If not see
66 +<http://www.gnu.org/licenses/>. */
68 +#undef TARGET_OS_CPP_BUILTINS
69 +#define TARGET_OS_CPP_BUILTINS() \
72 + GNU_USER_TARGET_OS_CPP_BUILTINS (); \
73 + builtin_define ("__uClinux__"); \
77 +#undef SUBTARGET_CPP_SPEC
78 +#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
81 +#define SIZE_TYPE "unsigned int"
84 +#define PTRDIFF_TYPE "int"
87 +#define WCHAR_TYPE "long int"
89 +#undef WCHAR_TYPE_SIZE
90 +#define WCHAR_TYPE_SIZE 32
94 + "%{mtext-section-literals:--text-section-literals} \
95 + %{mno-text-section-literals:--no-text-section-literals} \
96 + %{mtarget-align:--target-align} \
97 + %{mno-target-align:--no-target-align} \
98 + %{mlongcalls:--longcalls} \
99 + %{mno-longcalls:--no-longcalls} \
100 + %{mauto-litpools:--auto-litpools} \
101 + %{mno-auto-litpools:--no-auto-litpools}"
104 +#define LINK_SPEC "%{!no-elf2flt:%{!elf2flt*:-elf2flt}}"
106 +#undef LOCAL_LABEL_PREFIX
107 +#define LOCAL_LABEL_PREFIX "."
109 +/* Always enable "-fpic" for Xtensa Linux. */
110 +#define XTENSA_ALWAYS_PIC 1
112 +#undef TARGET_LIBC_HAS_FUNCTION
113 +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
115 +#undef DBX_REGISTER_NUMBER
117 Index: b/gcc/config/xtensa/uclinux.opt
118 ===================================================================
120 +++ b/gcc/config/xtensa/uclinux.opt
122 +; Xtensa uClinux options.
124 +; Copyright (C) 2015 Free Software Foundation, Inc.
126 +; This file is part of GCC.
128 +; GCC is free software; you can redistribute it and/or modify it under
129 +; the terms of the GNU General Public License as published by the Free
130 +; Software Foundation; either version 3, or (at your option) any later
133 +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
134 +; WARRANTY; without even the implied warranty of MERCHANTABILITY or
135 +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
138 +; You should have received a copy of the GNU General Public License
139 +; along with GCC; see the file COPYING3. If not see
140 +; <http://www.gnu.org/licenses/>.
142 +; See the GCC internals manual (options.texi) for a description of
143 +; this file's format.
145 +; Please try to keep this file in ASCII collating order.
151 +Driver JoinedOrMissing
153 +; This comment is to ensure we retain the blank line above.
154 Index: b/libgcc/config.host
155 ===================================================================
156 --- a/libgcc/config.host
157 +++ b/libgcc/config.host
158 @@ -1213,6 +1213,11 @@
159 tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc"
160 md_unwind_header=xtensa/linux-unwind.h
163 + tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc"
164 + md_unwind_header=xtensa/linux-unwind.h
165 + extra_parts="$extra_parts crtbeginS.o crtbeginT.o crtendS.o"
168 # Don't need crtbeginT.o from *-*-linux* default.
169 extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"