1 /* Definitions of target machine for GNU compiler,
2    for Alpha Linux-based GNU systems.
3    Copyright (C) 1996-2020 Free Software Foundation, Inc.
4    Contributed by Richard Henderson.
5 
6 This file is part of GCC.
7 
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12 
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21 
22 #define TARGET_OS_CPP_BUILTINS()				\
23     do {							\
24 	builtin_define ("__gnu_linux__");			\
25 	builtin_define ("_LONGLONG");				\
26 	builtin_define_std ("linux");				\
27 	builtin_define_std ("unix");				\
28 	builtin_assert ("system=linux");			\
29 	builtin_assert ("system=unix");				\
30 	builtin_assert ("system=posix");			\
31 	/* The GNU C++ standard library requires this.  */	\
32 	if (c_dialect_cxx ())					\
33 	  builtin_define ("_GNU_SOURCE");			\
34     } while (0)
35 
36 #undef LIB_SPEC
37 #define LIB_SPEC \
38   "%{pthread:-lpthread} \
39    %{shared:-lc} \
40    %{!shared: %{profile:-lc_p}%{!profile:-lc}}"
41 
42 #undef CPP_SPEC
43 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
44 
45 /* Show that we need a GP when profiling.  */
46 #undef TARGET_PROFILING_NEEDS_GP
47 #define TARGET_PROFILING_NEEDS_GP 1
48 
49 /* Don't care about faults in the prologue.  */
50 #undef TARGET_CAN_FAULT_IN_PROLOGUE
51 #define TARGET_CAN_FAULT_IN_PROLOGUE 1
52 
53 /* OS fixes up EV5 data fault on prefetch.  */
54 #undef TARGET_FIXUP_EV5_PREFETCH
55 #define TARGET_FIXUP_EV5_PREFETCH 1
56 
57 #undef WCHAR_TYPE
58 #define WCHAR_TYPE "int"
59 
60 #ifdef SINGLE_LIBC
61 #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
62 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
63 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
64 #undef OPTION_MUSL
65 #define OPTION_MUSL   (DEFAULT_LIBC == LIBC_MUSL)
66 #else
67 #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
68 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
69 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
70 #undef OPTION_MUSL
71 #define OPTION_MUSL   (linux_libc == LIBC_MUSL)
72 #endif
73 
74 /* Determine what functions are present at the runtime;
75    this includes full c99 runtime and sincos.  */
76 #undef TARGET_LIBC_HAS_FUNCTION
77 #define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
78 
79 #define TARGET_POSIX_IO
80 
81 /* Provide a STARTFILE_SPEC appropriate for ELF.  Here we add the
82    (even more) magical crtbegin.o file which provides part of the
83    support for getting C++ file-scope static object constructed
84    before entering `main'.  */
85 
86 #undef	STARTFILE_SPEC
87 #ifdef HAVE_LD_PIE
88 #define STARTFILE_SPEC \
89   "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
90    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
91 #else
92 #define STARTFILE_SPEC \
93   "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
94    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
95 #endif
96 
97 /* Provide a ENDFILE_SPEC appropriate for ELF.  Here we tack on the
98    magical crtend.o file which provides part of the support for
99    getting C++ file-scope static object constructed before entering
100    `main', followed by a normal ELF "finalizer" file, `crtn.o'.  */
101 
102 #undef	ENDFILE_SPEC
103 #define ENDFILE_SPEC \
104   "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
105    %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
106 
107 #define LINK_GCC_C_SEQUENCE_SPEC \
108   "%{static|static-pie:--start-group} %G %{!nolibc:%L} \
109    %{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"
110 
111 /* Use --as-needed -lgcc_s for eh support.  */
112 #ifdef HAVE_LD_AS_NEEDED
113 #define USE_LD_AS_NEEDED 1
114 #endif
115 
116 /* Define if long doubles should be mangled as 'g'.  */
117 #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
118 
119 /* -mcpu=native handling only makes sense with compiler running on
120    an Alpha chip.  */
121 #if defined(__alpha__) || defined(__alpha)
122 extern const char *host_detect_local_cpu (int argc, const char **argv);
123 # define EXTRA_SPEC_FUNCTIONS						\
124   { "local_cpu_detect", host_detect_local_cpu },
125 
126 # define MCPU_MTUNE_NATIVE_SPECS					\
127    " %{mcpu=native:%<mcpu=native %:local_cpu_detect(cpu)}"		\
128    " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
129 #else
130 # define MCPU_MTUNE_NATIVE_SPECS ""
131 #endif
132 
133 #define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS
134