1 /* Target independent definitions for LynxOS.
2    Copyright (C) 1993-2018 Free Software Foundation, Inc.
3 
4 This file is part of GCC.
5 
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
10 
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3.  If not see
18 <http://www.gnu.org/licenses/>.  */
19 
20 /* In this file we set up defaults that can be chosen by
21    <target>/lynx.h files.  A target-specific lynx.h file can decide
22    either to define and override these definitions or to use them by
23    ensuring they are undefined at this point.  If we were to #undef
24    them here we might accidentally disable some target-specific
25    defines.  */
26 
27 #ifndef EXTRA_OS_LYNX_TARGET_SPECS
28 # define EXTRA_OS_LYNX_TARGET_SPECS
29 #endif
30 
31 #ifndef EXTRA_OS_LYNX_SPECS
32 # define EXTRA_OS_LYNX_SPECS \
33   { "cpp_os_lynx", CPP_OS_LYNX_SPEC }, \
34   { "lib_os_lynx", LIB_OS_LYNX_SPEC }, \
35   { "link_os_lynx", LINK_OS_LYNX_SPEC }, \
36   { "startfile_os_lynx", STARTFILE_OS_LYNX_SPEC }, \
37   { "endfile_os_lynx", ENDFILE_OS_LYNX_SPEC }, \
38   EXTRA_OS_LYNX_TARGET_SPECS
39 #endif
40 
41 #ifndef SUBTARGET_EXTRA_SPECS
42 # define SUBTARGET_EXTRA_SPECS EXTRA_OS_LYNX_SPECS
43 #endif
44 
45 #ifndef CPP_SPEC
46 # define CPP_SPEC "%(cpp_cpu) %(cpp_os_lynx)"
47 #endif
48 
49 #ifndef LIB_SPEC
50 # define LIB_SPEC "%(lib_os_lynx)"
51 #endif
52 
53 #ifndef LINK_SPEC
54 # define LINK_SPEC "%(link_os_lynx)"
55 #endif
56 
57 #ifndef STARTFILE_SPEC
58 # define STARTFILE_SPEC "%(startfile_os_lynx)"
59 #endif
60 
61 #ifndef ENDFILE_SPEC
62 # define ENDFILE_SPEC "%(endfile_os_lynx)"
63 #endif
64 
65 #ifndef CPP_OS_LYNX_SPEC
66 # define CPP_OS_LYNX_SPEC \
67 "%{mthreads: \
68    %{mlegacy-threads: \
69      %ecannot use mthreads and mlegacy-threads together}} \
70  %{mthreads: -D_MULTITHREADED} \
71  %{mlegacy-threads: -D_THREADS_POSIX4ad4} \
72  -Asystem=lynx -Asystem=unix -D__Lynx__ -D__unix__"
73 #endif
74 
75 #ifndef LIB_OS_LYNX_SPEC
76 # define LIB_OS_LYNX_SPEC \
77 "%{mlegacy-threads:-lposix-pre1c} -lm -lc"
78 #endif
79 
80 /* We link static executables for LynxOS by default unless -mshared is
81    used when linking an executable.  Along the same line, we link to
82    shared libraries when linking a shared object by default unless
83    -static is used.
84 
85    We have to pass in our -L options here otherwise the translated
86    startfile directories (%D) will take priority over this.
87    Furthermore since we have to pass in -L options here we have to
88    make sure that -L options provided by the user take priority over
89    everything we specify.  */
90 
91 #ifndef LINK_OS_LYNX_SPEC
92 # define LINK_OS_LYNX_SPEC \
93 "%{shared} %{static} \
94  %{mshared: %{static: %ecannot use mshared and static together}} \
95  %{!mshared: %{!shared: %{!static: -static}}} \
96  %{L*} \
97  %{mthreads: \
98    %{mshared: -L/lib/thread/shlib -rpath /lib/thread/shlib} \
99    %{shared: \
100      %{!static: -L/lib/thread/shlib -rpath /lib/thread/shlib} \
101    %{!mshared: -L/lib/thread}} \
102    %{shared: %{static: -L/lib/thread}}} \
103  %{!mthreads: \
104    %{mshared: -L/lib/shlib -rpath /lib/shlib} \
105    %{shared: -L/lib/shlib -rpath /lib/shlib}} \
106  %{mlegacy-threads:-lposix-pre1c} -lm -lc"
107 #endif
108 
109 #ifndef STARTFILE_OS_LYNX_SPEC
110 # define STARTFILE_OS_LYNX_SPEC \
111 "%{!shared: \
112    %{!mthreads: \
113      %{p:gcrt1.o%s} %{pg:gcrt1.o%s} \
114      %{!p:%{!pg:crt1.o%s}}} \
115    %{mthreads: \
116      %{p:thread/gcrt1.o%s} %{pg:thread/gcrt1.o%s} \
117      %{!p:%{!pg:thread/crt1.o%s }}}}\
118  %{mthreads: thread/crti.o%s} %{!mthreads: crti.o%s} \
119  %{!shared: crtbegin.o%s} \
120  %{shared: crtbeginS.o%s}"
121 #endif
122 
123 #ifndef ENDFILE_OS_LYNX_SPEC
124 # define ENDFILE_OS_LYNX_SPEC \
125 "%{!shared: crtend.o%s} \
126  %{shared: crtendS.o%s} \
127  %{mthreads: thread/crtn.o%s} %{!mthreads: crtn.o%s}"
128 #endif
129 
130 /* Define the actual types of some ANSI-mandated types.  */
131 
132 #ifndef SIZE_TYPE
133 # define SIZE_TYPE "unsigned int"
134 #endif
135 
136 #ifndef  PTRDIFF_TYPE
137 # define PTRDIFF_TYPE "int"
138 #endif
139 
140 #ifndef  WCHAR_TYPE
141 # define WCHAR_TYPE "long int"
142 #endif
143 
144 #ifndef  WCHAR_TYPE_SIZE
145 # define WCHAR_TYPE_SIZE BITS_PER_WORD
146 #endif
147 
148 /* Define ASM_OUTPUT_ALIGN to use the .balign directive rather that
149    the .align directive with GAS.  */
150 
151 #ifndef ASM_OUTPUT_ALIGN
152 # define ASM_OUTPUT_ALIGN(FILE, LOG) 			\
153   do							\
154     {							\
155       if ((LOG) != 0)					\
156 	fprintf ((FILE), "\t.balign %d\n", 1 << (LOG));	\
157     }							\
158   while (0)
159 #endif
160 
161 /* Keep the *_DEBUGGING_INFO defines from elfos.h except that stabs is
162    the default on LynxOS.  */
163 
164 #ifndef PREFERRED_DEBUGGING_TYPE
165 # define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
166 #endif
167 
168 /* We have C++ support in our system headers.  */
169 
170 #ifndef NO_IMPLICIT_EXTERN_C
171 # define NO_IMPLICIT_EXTERN_C
172 #endif
173 
174 #ifndef TARGET_POSIX_IO
175 # define TARGET_POSIX_IO
176 #endif
177