lynx.h revision 18334
1/* Target independent definitions for LynxOS.
2   Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING.  If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA.  */
20
21/* LynxOS is a multi-platform Unix, similar to SVR3, but not identical.
22   We can get quite a bit from generic svr3, but have to do some overrides. */
23
24#include "svr3.h"
25
26/* Define various macros, depending on the combination of flags. */
27
28#undef CPP_SPEC
29#define CPP_SPEC "%{mthreads:-D_MULTITHREADED}  \
30  %{mposix:-D_POSIX_SOURCE}  \
31  %{msystem-v:-I/usr/include_v}"
32
33/* No asm spec needed, since using GNU assembler always. */
34
35/* No linker spec needed, since using GNU linker always. */
36
37#undef LIB_SPEC
38#define LIB_SPEC "%{mthreads:-L/lib/thread/}  \
39  %{msystem-v:-lc_v}  \
40  %{!msystem-v:%{mposix:-lc_p} -lc -lm}"
41
42/* Set the appropriate names for the Lynx startfiles. */
43
44#undef STARTFILE_SPEC
45#define STARTFILE_SPEC "%{p:%{mthreads:thread/pinit1.o%s}%{!mthreads:pinit1.o%s}}%{!p:%{msystem-v:vinit1.o%s -e_start}%{!msystem-v:%{mthreads:thread/init1.o%s}%{!mthreads:init1.o%s}}}"
46
47#undef ENDFILE_SPEC
48#define ENDFILE_SPEC "%{p:_etext.o%s}%{!p:initn.o%s}"
49
50/* Override the svr3 versions. */
51
52#undef WCHAR_TYPE
53#define WCHAR_TYPE "int"
54
55#undef PTRDIFF_TYPE
56#define PTRDIFF_TYPE "long int"
57
58/* We want to output DBX (stabs) debugging information normally.  */
59
60#define DBX_DEBUGGING_INFO
61#undef PREFERRED_DEBUGGING_TYPE
62#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
63
64/* It is convenient to be able to generate standard coff debugging
65   if requested via -gcoff. */
66
67#define SDB_DEBUGGING_INFO
68
69/* Be function-relative for block and source line stab directives. */
70
71#define DBX_BLOCKS_FUNCTION_RELATIVE 1
72
73/* but, to make this work, functions must appear prior to line info */
74
75#define DBX_FUNCTION_FIRST
76
77/* Generate a blank trailing N_SO to mark the end of the .o file, since
78   we can't depend upon the linker to mark .o file boundaries with
79   embedded stabs.  */
80
81#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME)			\
82  fprintf (FILE,							\
83	   "\t.text\n\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO)
84
85#undef  ASM_OUTPUT_SOURCE_LINE
86#define ASM_OUTPUT_SOURCE_LINE(file, line)		\
87  { static int sym_lineno = 1;				\
88    fprintf (file, ".stabn 68,0,%d,.LM%d-",		\
89	     line, sym_lineno);				\
90    assemble_name (file,				\
91		   XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
92    fprintf (file, "\n.LM%d:\n", sym_lineno);		\
93    sym_lineno += 1; }
94
95/* Handle #pragma pack and sometimes #pragma weak.  */
96
97#define HANDLE_SYSV_PRAGMA
98
99/* Some additional command-line options. */
100
101#define TARGET_THREADS	(target_flags & MASK_THREADS)
102#define MASK_THREADS	0x40000000
103
104#define TARGET_POSIX	(target_flags & MASK_POSIX)
105#define MASK_POSIX	0x20000000
106
107#define TARGET_SYSTEM_V	(target_flags & MASK_SYSTEM_V)
108#define MASK_SYSTEM_V	0x10000000
109
110#undef SUBTARGET_SWITCHES
111#define SUBTARGET_SWITCHES \
112    {"threads",		MASK_THREADS},		\
113    {"posix",		MASK_POSIX},		\
114    {"system-v",	MASK_SYSTEM_V},
115
116#undef SUBTARGET_OVERRIDE_OPTIONS
117#define SUBTARGET_OVERRIDE_OPTIONS \
118do {								\
119  if (TARGET_SYSTEM_V && profile_flag)				\
120    warning ("-msystem-v and -p are incompatible");		\
121  if (TARGET_SYSTEM_V && TARGET_THREADS)			\
122    warning ("-msystem-v and -mthreads are incompatible");	\
123} while (0)
124
125/* Define this so that C++ destructors will use atexit, since LynxOS
126   calls exit after main returns.  */
127
128#define HAVE_ATEXIT
129
130/* Since init.o et al put all sorts of stuff into the init section,
131   we can't use the standard init section support in crtbegin.o. */
132
133#undef INIT_SECTION_ASM_OP
134
135#undef EXTRA_SECTIONS
136#define EXTRA_SECTIONS in_const, in_bss, in_ctors, in_dtors, in_fini,
137
138#undef EXTRA_SECTION_FUNCTIONS
139#define EXTRA_SECTION_FUNCTIONS					\
140  CONST_SECTION_FUNCTION					\
141  BSS_SECTION_FUNCTION						\
142  CTORS_SECTION_FUNCTION					\
143  DTORS_SECTION_FUNCTION					\
144  FINI_SECTION_FUNCTION
145
146#undef CTORS_SECTION_ASM_OP
147#define CTORS_SECTION_ASM_OP	".section\t.ctors"
148#undef DTORS_SECTION_ASM_OP
149#define DTORS_SECTION_ASM_OP	".section\t.dtors"
150
151#define INT_ASM_OP		".long"
152
153/* A C statement (sans semicolon) to output an element in the table of
154   global constructors.  */
155#undef ASM_OUTPUT_CONSTRUCTOR
156#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)				\
157  do {									\
158    ctors_section ();							\
159    fprintf (FILE, "\t%s\t ", INT_ASM_OP);				\
160    assemble_name (FILE, NAME);						\
161    fprintf (FILE, "\n");						\
162  } while (0)
163
164/* A C statement (sans semicolon) to output an element in the table of
165   global destructors.  */
166#undef ASM_OUTPUT_DESTRUCTOR
167#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)       				\
168  do {									\
169    dtors_section ();                   				\
170    fprintf (FILE, "\t%s\t ", INT_ASM_OP);				\
171    assemble_name (FILE, NAME);              				\
172    fprintf (FILE, "\n");						\
173  } while (0)
174
175#undef DO_GLOBAL_CTORS_BODY
176#undef DO_GLOBAL_DTORS_BODY
177
178/* LynxOS doesn't have mcount. */
179#undef FUNCTION_PROFILER
180#define FUNCTION_PROFILER(file, profile_label_no)
181