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