Skip to content

Commit 19a0b9e

Browse files
committed
zephyr: xtensa: enable multilib to build for call0 ABI
This enables multilib builds for Zephyr Xtensa toolchains supporting both CALL0 and Windowed ABIs, where Windowed ABI is the default. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
1 parent db5fcf3 commit 19a0b9e

File tree

3 files changed

+133
-0
lines changed

3 files changed

+133
-0
lines changed

gcc/config.gcc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3600,6 +3600,11 @@ xstormy16-*-elf)
36003600
extra_options=stormy16/stormy16.opt
36013601
tmake_file="stormy16/t-stormy16"
36023602
;;
3603+
xtensa*-*_zephyr-elf*)
3604+
tm_file="${tm_file} elfos.h newlib-stdint.h xtensa/zephyr.h"
3605+
extra_options="${extra_options} xtensa/elf.opt"
3606+
tmake_file="${tmake_file} xtensa/t-zephyr"
3607+
;;
36033608
xtensa*-*-elf*)
36043609
tm_file="${tm_file} elfos.h newlib-stdint.h xtensa/elf.h"
36053610
extra_options="${extra_options} xtensa/elf.opt"

gcc/config/xtensa/t-zephyr

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (C) 2016, 2023 Intel Corporation.
2+
#
3+
# This file is part of GCC.
4+
#
5+
# GCC is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 3, or (at your option)
8+
# any later version.
9+
#
10+
# GCC is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with GCC; see the file COPYING3. If not see
17+
# <http://www.gnu.org/licenses/>.
18+
#
19+
20+
MULTILIB_OPTIONS += mabi=call0/mabi=windowed
21+
MULTILIB_DIRNAMES += call0 windowed

gcc/config/xtensa/zephyr.h

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/* Xtensa/Elf configuration.
2+
Derived from the configuration for GCC for Intel i386 running Linux.
3+
Copyright (C) 2001-2022 Free Software Foundation, Inc.
4+
5+
This file is part of GCC.
6+
7+
GCC is free software; you can redistribute it and/or modify it under
8+
the terms of the GNU General Public License as published by the Free
9+
Software Foundation; either version 3, or (at your option) any later
10+
version.
11+
12+
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
14+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15+
for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with GCC; see the file COPYING3. If not see
19+
<http://www.gnu.org/licenses/>. */
20+
21+
#define TARGET_SECTION_TYPE_FLAGS xtensa_multibss_section_type_flags
22+
23+
#undef ASM_APP_ON
24+
#define ASM_APP_ON "#APP\n"
25+
26+
#undef ASM_APP_OFF
27+
#define ASM_APP_OFF "#NO_APP\n"
28+
29+
#undef SIZE_TYPE
30+
#define SIZE_TYPE "unsigned int"
31+
32+
#undef PTRDIFF_TYPE
33+
#define PTRDIFF_TYPE "int"
34+
35+
#undef WCHAR_TYPE
36+
#define WCHAR_TYPE "short unsigned int"
37+
38+
#undef WCHAR_TYPE_SIZE
39+
#define WCHAR_TYPE_SIZE 16
40+
41+
#undef ASM_SPEC
42+
#define ASM_SPEC \
43+
"%{mtext-section-literals:--text-section-literals} \
44+
%{mno-text-section-literals:--no-text-section-literals} \
45+
%{mtarget-align:--target-align} \
46+
%{mno-target-align:--no-target-align} \
47+
%{mlongcalls:--longcalls} \
48+
%{mno-longcalls:--no-longcalls} \
49+
%{mauto-litpools:--auto-litpools} \
50+
%{mno-auto-litpools:--no-auto-litpools} \
51+
%{mabi=windowed:--abi-windowed} \
52+
%{mabi=call0:--abi-call0}"
53+
54+
#undef MULTILIB_DEFAULTS
55+
#define MULTILIB_DEFAULTS { "mabi=windowed" }
56+
57+
#undef LIB_SPEC
58+
#define LIB_SPEC "-lc -lsim -lc -lhandlers-sim -lhal"
59+
60+
#undef STARTFILE_SPEC
61+
#define STARTFILE_SPEC \
62+
"crt1-sim%O%s crt0%O%s crti%O%s crtbegin%O%s _vectors%O%s"
63+
64+
#undef ENDFILE_SPEC
65+
#define ENDFILE_SPEC "crtend%O%s crtn%O%s"
66+
67+
#undef LINK_SPEC
68+
#define LINK_SPEC \
69+
"%{shared:-shared} \
70+
%{!shared: \
71+
%{!static: \
72+
%{rdynamic:-export-dynamic} \
73+
%{static:-static}}} \
74+
%{mabi=windowed:--abi-windowed} \
75+
%{mabi=call0:--abi-call0}"
76+
77+
#undef LOCAL_LABEL_PREFIX
78+
#define LOCAL_LABEL_PREFIX "."
79+
80+
/* Avoid dots for compatibility with VxWorks. */
81+
#undef NO_DOLLAR_IN_LABEL
82+
#define NO_DOT_IN_LABEL
83+
84+
/* Do not force "-fpic" for this target. */
85+
#define XTENSA_ALWAYS_PIC 0
86+
87+
#undef DBX_REGISTER_NUMBER
88+
89+
/* Search for headers in $tooldir/arch/include and for libraries and
90+
startfiles in $tooldir/arch/lib. */
91+
#define GCC_DRIVER_HOST_INITIALIZATION \
92+
do \
93+
{ \
94+
char *tooldir, *archdir; \
95+
tooldir = concat (tooldir_base_prefix, spec_machine, \
96+
dir_separator_str, NULL); \
97+
if (!IS_ABSOLUTE_PATH (tooldir)) \
98+
tooldir = concat (standard_exec_prefix, spec_machine, dir_separator_str, \
99+
spec_version, dir_separator_str, tooldir, NULL); \
100+
archdir = concat (tooldir, "arch", dir_separator_str, NULL); \
101+
add_prefix (&startfile_prefixes, \
102+
concat (archdir, "lib", dir_separator_str, NULL), \
103+
"GCC", PREFIX_PRIORITY_LAST, 0, 1); \
104+
add_prefix (&include_prefixes, archdir, \
105+
"GCC", PREFIX_PRIORITY_LAST, 0, 0); \
106+
} \
107+
while (0)

0 commit comments

Comments
 (0)