linux.h revision 1.1.1.2
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 1
25
26#undef  SIZE_TYPE
27#define SIZE_TYPE "unsigned int"
28
29#undef  PTRDIFF_TYPE
30#define PTRDIFF_TYPE "int"
31
32#define TARGET_OS_CPP_BUILTINS()                \
33  do                                            \
34    {                                           \
35      GNU_USER_TARGET_OS_CPP_BUILTINS();           \
36    }                                           \
37  while (0)
38
39#ifdef TARGET_BIG_ENDIAN_DEFAULT
40#define LD_SO_ENDIAN_SPEC "%{mlittle-endian:le}%{!mlittle-endian:be}"
41#else
42#define LD_SO_ENDIAN_SPEC "%{mbig-endian:be}%{!mbig-endian:le}"
43#endif
44
45/* Record arch version in TARGET_ARCH_DEFAULT.
46   0 means soft ABI;
47   1 means hard ABI and using full floating-point instruction;
48   2 means hard ABI and only using single-precision floating-point
49   instruction.  */
50#if TARGET_ARCH_DEFAULT
51#define LD_SO_ABI_SPEC "%{!mabi=2:f}"
52#else
53#define LD_SO_ABI_SPEC "%{mabi=2fp+:f}"
54#endif
55
56#define GLIBC_DYNAMIC_LINKER \
57  "/lib/ld-linux-nds32" LD_SO_ENDIAN_SPEC LD_SO_ABI_SPEC ".so.1"
58
59/* In the configure stage we may use options --enable-default-relax,
60   --enable-Os-default-ifc and --enable-Os-default-ex9.  They effect
61   the default spec of passing --relax, --mifc, and --mex9 to linker.
62   We use NDS32_RELAX_SPEC, NDS32_IFC_SPEC, and NDS32_EX9_SPEC
63   so that we can customize them conveniently.  */
64#define LINK_SPEC \
65 " %{G*}" \
66 " %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
67 " %{shared:-shared} \
68  %{!shared: \
69    %{!static: \
70      %{rdynamic:-export-dynamic} \
71      -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
72    %{static:-static}}" \
73  NDS32_RELAX_SPEC
74
75#define LINK_PIE_SPEC "%{pie:%{!fno-pie:%{!fno-PIE:%{!static:-pie}}}} "
76
77#define CPP_SPEC "%{pthread:-D_REENTRANT}"
78
79/* The SYNC operations are implemented as library functions, not
80   INSN patterns.  As a result, the HAVE defines for the patterns are
81   not defined.  We need to define them to generate the corresponding
82   __GCC_HAVE_SYNC_COMPARE_AND_SWAP_* and __GCC_ATOMIC_*_LOCK_FREE
83   defines.
84   Ref: https://sourceware.org/ml/libc-alpha/2014-09/msg00322.html  */
85#define HAVE_sync_compare_and_swapqi 1
86#define HAVE_sync_compare_and_swaphi 1
87#define HAVE_sync_compare_and_swapsi 1
88