1/* Definitions of target machine of Andes NDS32 cpu for GNU compiler
2   Copyright (C) 2012-2020 Free Software Foundation, Inc.
3   Contributed by Andes Technology Corporation.
4
5   This file is part of GCC.
6
7   GCC is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published
9   by the Free Software Foundation; either version 3, or (at your
10   option) any later version.
11
12   GCC is distributed in the hope that it will be useful, but WITHOUT
13   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15   License 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
22/* ------------------------------------------------------------------------ */
23
24#define TARGET_LINUX_ABI 0
25
26/* In the configure stage we may use options --enable-default-relax,
27   --enable-Os-default-ifc and --enable-Os-default-ex9.  They effect
28   the default spec of passing --relax, --mifc, and --mex9 to linker.
29   We use NDS32_RELAX_SPEC, NDS32_IFC_SPEC, and NDS32_EX9_SPEC
30   so that we can customize them conveniently.  */
31#define LINK_SPEC \
32  " %{G*}" \
33  " %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
34  " %{shared:-shared}" \
35  NDS32_RELAX_SPEC
36
37#define LIB_SPEC \
38  " -lc -lgloss"
39
40#define LIBGCC_SPEC \
41  " -lgcc"
42
43/* The option -mno-ctor-dtor can disable constructor/destructor feature
44   by applying different crt stuff.  In the convention, crt0.o is the
45   startup file without constructor/destructor;
46   crt1.o, crti.o, crtbegin.o, crtend.o, and crtn.o are the
47   startup files with constructor/destructor.
48   Note that crt0.o, crt1.o, crti.o, and crtn.o are provided
49   by newlib/mculib/glibc/ublic, while crtbegin.o and crtend.o are
50   currently provided by GCC for nds32 target.
51
52   For nds32 target so far:
53   If -mno-ctor-dtor, we are going to link
54   "crt0.o [user objects]".
55   If -mctor-dtor, we are going to link
56   "crt1.o crtbegin1.o [user objects] crtend1.o".
57
58   Note that the TARGET_DEFAULT_CTOR_DTOR would effect the
59   default behavior.  Check gcc/config.gcc for more information.  */
60#ifdef TARGET_DEFAULT_CTOR_DTOR
61  #define STARTFILE_SPEC \
62    " %{!mno-ctor-dtor:crt1.o%s;:crt0.o%s}" \
63    " %{!mno-ctor-dtor:crtbegin1.o%s}" \
64    " %{mcrt-arg:crtarg.o%s}"
65  #define ENDFILE_SPEC \
66    " %{!mno-ctor-dtor:crtend1.o%s}"
67#else
68  #define STARTFILE_SPEC \
69    " %{mctor-dtor|coverage:crt1.o%s;:crt0.o%s}" \
70    " %{mctor-dtor|coverage:crtbegin1.o%s}" \
71    " %{mcrt-arg:crtarg.o%s}"
72  #define ENDFILE_SPEC \
73    " %{mctor-dtor|coverage:crtend1.o%s}"
74#endif
75
76#define STARTFILE_CXX_SPEC \
77  " %{!mno-ctor-dtor:crt1.o%s;:crt0.o%s}" \
78  " %{!mno-ctor-dtor:crtbegin1.o%s}" \
79  " %{mcrt-arg:crtarg.o%s}"
80#define ENDFILE_CXX_SPEC \
81  " %{!mno-ctor-dtor:crtend1.o%s}"
82