freebsd.h revision 34269
190792Sgshapiro/* Definitions for Intel 386 running FreeBSD with either a.out or ELF format
290792Sgshapiro   Copyright (C) 1994, 1995 Free Software Foundation, Inc.
390792Sgshapiro   Contributed by Eric Youngdale.
490792Sgshapiro   Modified for stabs-in-ELF by H.J. Lu.
590792Sgshapiro   Adapted from Linux version by John Polstra.
690792Sgshapiro   Added support for generating "old a.out gas" on the fly by Peter Wemm.
790792Sgshapiro
890792SgshapiroThis file is part of GNU CC.
990792Sgshapiro
1090792SgshapiroGNU CC is free software; you can redistribute it and/or modify
1190792Sgshapiroit under the terms of the GNU General Public License as published by
1290792Sgshapirothe Free Software Foundation; either version 2, or (at your option)
1390792Sgshapiroany later version.
1490792Sgshapiro
1590792SgshapiroGNU CC is distributed in the hope that it will be useful,
1690792Sgshapirobut WITHOUT ANY WARRANTY; without even the implied warranty of
1790792SgshapiroMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1890792SgshapiroGNU General Public License for more details.
1990792Sgshapiro
2090792SgshapiroYou should have received a copy of the GNU General Public License
2190792Sgshapiroalong with GNU CC; see the file COPYING.  If not, write to
2290792Sgshapirothe Free Software Foundation, 59 Temple Place - Suite 330,
2390792SgshapiroBoston, MA 02111-1307, USA.  */
2490792Sgshapiro
2590792Sgshapiro/* A lie, I guess, but the general idea behind FreeBSD/ELF is that we are
2690792Sgshapiro   supposed to be outputting something that will assemble under SVr4.
2790792Sgshapiro   This gets us pretty close.  */
2890792Sgshapiro#include <i386/i386.h>	/* Base i386 target machine definitions */
2990792Sgshapiro#include <i386/att.h>	/* Use the i386 AT&T assembler syntax */
3090792Sgshapiro#include <linux.h>	/* some common stuff */
3190792Sgshapiro
3290792Sgshapiro/* Don't assume anything about the header files. */
3390792Sgshapiro#define NO_IMPLICIT_EXTERN_C
3490792Sgshapiro
3590792Sgshapiro/* This defines which switch letters take arguments.  On svr4, most of
3690792Sgshapiro   the normal cases (defined in gcc.c) apply, and we also have -h* and
3790792Sgshapiro   -z* options (for the linker).  We have a slightly different mix.  We
3890792Sgshapiro   have -R (alias --rpath), no -z, --soname (-h), --assert etc. */
3990792Sgshapiro
4090792Sgshapiro#undef SWITCH_TAKES_ARG
4190792Sgshapiro#define SWITCH_TAKES_ARG(CHAR) \
4290792Sgshapiro  (   (CHAR) == 'D' \
4390792Sgshapiro   || (CHAR) == 'U' \
4490792Sgshapiro   || (CHAR) == 'o' \
4590792Sgshapiro   || (CHAR) == 'e' \
4690792Sgshapiro   || (CHAR) == 'T' \
4790792Sgshapiro   || (CHAR) == 'u' \
4890792Sgshapiro   || (CHAR) == 'I' \
4990792Sgshapiro   || (CHAR) == 'm' \
5090792Sgshapiro   || (CHAR) == 'L' \
5190792Sgshapiro   || (CHAR) == 'A' \
5290792Sgshapiro   || (CHAR) == 'h' \
5390792Sgshapiro   || (CHAR) == 'z' /* ignored by ld */ \
5490792Sgshapiro   || (CHAR) == 'R')
5590792Sgshapiro
5690792Sgshapiro#undef WORD_SWITCH_TAKES_ARG
5790792Sgshapiro#define WORD_SWITCH_TAKES_ARG(STR)					\
5890792Sgshapiro  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)					\
5990792Sgshapiro   || !strcmp (STR, "rpath") || !strcmp (STR, "rpath-link")		\
6090792Sgshapiro   || !strcmp (STR, "soname") || !strcmp (STR, "defsym") 		\
6190792Sgshapiro   || !strcmp (STR, "assert") || !strcmp (STR, "dynamic-linker"))
6290792Sgshapiro
6390792Sgshapiro#undef TARGET_VERSION
6490792Sgshapiro#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD)");
6590792Sgshapiro
6690792Sgshapiro#define MASK_PROFILER_EPILOGUE	010000000000
6790792Sgshapiro#define MASK_AOUT		004000000000	/* a.out not elf */
6890792Sgshapiro#define MASK_UNDERSCORES	002000000000	/* use leading _ */
6990792Sgshapiro
7090792Sgshapiro#define TARGET_PROFILER_EPILOGUE	(target_flags & MASK_PROFILER_EPILOGUE)
7190792Sgshapiro#define TARGET_AOUT			(target_flags & MASK_AOUT)
7290792Sgshapiro#define TARGET_ELF			((target_flags & MASK_AOUT) == 0)
7390792Sgshapiro#define TARGET_UNDERSCORES		((target_flags & MASK_UNDERSCORES) != 0)
7490792Sgshapiro
7590792Sgshapiro#undef	SUBTARGET_SWITCHES
7690792Sgshapiro#define SUBTARGET_SWITCHES					\
7790792Sgshapiro     { "profiler-epilogue",	 MASK_PROFILER_EPILOGUE},	\
7890792Sgshapiro     { "no-profiler-epilogue",	-MASK_PROFILER_EPILOGUE},	\
7990792Sgshapiro     { "aout",			 MASK_AOUT},			\
8090792Sgshapiro     { "no-aout",		-MASK_AOUT},			\
81112810Sgshapiro     { "underscores",		 MASK_UNDERSCORES},		\
8290792Sgshapiro     { "no-underscores",	-MASK_UNDERSCORES},
8390792Sgshapiro
8490792Sgshapiro/* The svr4 ABI for the i386 says that records and unions are returned
8590792Sgshapiro   in memory.  */
8690792Sgshapiro/* On FreeBSD, we do not. */
87112810Sgshapiro#undef DEFAULT_PCC_STRUCT_RETURN
8890792Sgshapiro#define DEFAULT_PCC_STRUCT_RETURN 0
8990792Sgshapiro
9090792Sgshapiro#define SUPPORTS_WEAK	TARGET_ELF
91112810Sgshapiro
9290792Sgshapiro/* Prefix for internally generated assembler labels.  If we aren't using
9390792Sgshapiro   underscores, we are using prefix `.'s to identify labels that should
9490792Sgshapiro   be ignored, as in `i386/gas.h' --karl@cs.umb.edu  */
95#undef  LPREFIX
96#define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
97
98/* Override the default comment-starter of "/".  */
99#undef ASM_COMMENT_START
100#define ASM_COMMENT_START "#"
101
102#undef COMMENT_BEGIN
103#define COMMENT_BEGIN "#"
104
105#undef ASM_APP_ON
106#define ASM_APP_ON "#APP\n"
107
108#undef ASM_APP_OFF
109#define ASM_APP_OFF "#NO_APP\n"
110
111/* Output at beginning of assembler file.  */
112/* The .file command should always begin the output.  */
113
114#undef ASM_FILE_START
115#define ASM_FILE_START(FILE)						\
116  do {									\
117        output_file_directive (FILE, main_input_filename);		\
118	if (TARGET_ELF)							\
119          fprintf (FILE, "\t.version\t\"01.01\"\n");			\
120  } while (0)
121
122/* don't override the defauts, in case gdb gets upset */
123#undef ASM_IDENTIFY_GCC
124
125/* This is how to store into the string BUF
126   the symbol_ref name of an internal numbered label where
127   PREFIX is the class of label and NUM is the number within the class.
128   This is suitable for output with `assemble_name'.  */
129#undef	ASM_GENERATE_INTERNAL_LABEL
130#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER)			\
131    sprintf ((BUF), "*%s%s%d", (TARGET_UNDERSCORES) ? "" : ".",		\
132	     (PREFIX), (NUMBER))
133
134/* This is how to output an internal numbered label where
135   PREFIX is the class of label and NUM is the number within the class.  */
136#undef	ASM_OUTPUT_INTERNAL_LABEL
137#define	ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)			\
138  fprintf (FILE, "%s%s%d:\n", (TARGET_UNDERSCORES) ? "" : ".",		\
139	   PREFIX, NUM)
140
141/* This is how to output a reference to a user-level label named NAME.  */
142#undef  ASM_OUTPUT_LABELREF
143#define ASM_OUTPUT_LABELREF(FILE,NAME)					\
144  fprintf (FILE, "%s%s", (TARGET_UNDERSCORES) ? "_" : "", NAME)
145
146
147/* This is how to output an element of a case-vector that is relative.
148   This is only used for PIC code.  See comments by the `casesi' insn in
149   i386.md for an explanation of the expression this outputs. */
150#undef ASM_OUTPUT_ADDR_DIFF_ELT
151#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
152  fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
153
154#undef ASM_OUTPUT_ALIGN
155#define ASM_OUTPUT_ALIGN(FILE,LOG)      \
156  if ((LOG)!=0) fprintf ((FILE), "\t.p2align %d\n", (LOG))
157
158/* Align labels, etc. at 4-byte boundaries.
159   For the 486, align to 16-byte boundary for sake of cache.  */
160#undef ASM_OUTPUT_ALIGN_CODE
161#define ASM_OUTPUT_ALIGN_CODE(FILE) \
162  fprintf ((FILE), "\t.p2align %d,0x90\n", i386_align_jumps)
163
164/* Align start of loop at 4-byte boundary.  */
165#undef ASM_OUTPUT_LOOP_ALIGN
166#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
167  fprintf ((FILE), "\t.p2align %d,0x90\n", i386_align_loops)
168
169
170/* conditionalize the use of ".section rodata" on elf mode - otherwise .text */
171#undef USE_CONST_SECTION
172#define USE_CONST_SECTION	TARGET_ELF
173
174/* A C statement (sans semicolon) to output an element in the table of
175   global constructors.  */
176#undef ASM_OUTPUT_CONSTRUCTOR
177#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)				\
178  do {									\
179    if (TARGET_ELF) {							\
180      ctors_section ();							\
181      fprintf (FILE, "\t%s\t ", INT_ASM_OP);				\
182      assemble_name (FILE, NAME);					\
183      fprintf (FILE, "\n");						\
184    } else {								\
185      fprintf (asm_out_file, "%s \"%s__CTOR_LIST__\",22,0,0,", ASM_STABS_OP, \
186	       (TARGET_UNDERSCORES) ? "_" : "");			\
187      assemble_name (asm_out_file, name);				\
188      fputc ('\n', asm_out_file);					\
189    }									\
190  } while (0)
191
192/* A C statement (sans semicolon) to output an element in the table of
193   global destructors.  */
194#undef ASM_OUTPUT_DESTRUCTOR
195#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)				\
196  do {									\
197    if (TARGET_ELF) {							\
198      dtors_section ();							\
199      fprintf (FILE, "\t%s\t ", INT_ASM_OP);				\
200      assemble_name (FILE, NAME);					\
201      fprintf (FILE, "\n");						\
202    } else {								\
203      fprintf (asm_out_file, "%s \"%s__DTOR_LIST__\",22,0,0,", ASM_STABS_OP, \
204	       (TARGET_UNDERSCORES) ? "_" : "");			\
205      assemble_name (asm_out_file, name);				\
206      fputc ('\n', asm_out_file);					\
207    }									\
208  } while (0)
209
210/* This says how to output assembler code to declare an
211   uninitialized internal linkage data object.  Under SVR4,
212   the linker seems to want the alignment of data objects
213   to depend on their types.  We do exactly that here.  */
214
215#undef ASM_OUTPUT_ALIGNED_LOCAL
216#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)		\
217do {									\
218  if (TARGET_ELF) {							\
219    fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP);				\
220    assemble_name ((FILE), (NAME));					\
221    fprintf ((FILE), "\n");						\
222    ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN);		\
223  } else {								\
224    int rounded = (SIZE);						\
225    if (rounded == 0) rounded = 1;					\
226    rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1;			\
227    rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT)		\
228			   * (BIGGEST_ALIGNMENT / BITS_PER_UNIT));	\
229    fputs (".lcomm ", (FILE));						\
230    assemble_name ((FILE), (NAME));					\
231    fprintf ((FILE), ",%u\n", (rounded));				\
232  }									\
233} while (0)
234
235#undef ASM_OUTPUT_ALIGNED_COMMON
236#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
237do {									\
238  if (TARGET_ELF) {							\
239    fprintf ((FILE), "\t%s\t", COMMON_ASM_OP);				\
240    assemble_name ((FILE), (NAME));					\
241    fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT);	\
242  } else {								\
243    int rounded = (SIZE);						\
244    if (rounded == 0) rounded = 1;					\
245    rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1;			\
246    rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT)		\
247			   * (BIGGEST_ALIGNMENT / BITS_PER_UNIT));	\
248    fputs (".comm ", (FILE));						\
249    assemble_name ((FILE), (NAME));					\
250    fprintf ((FILE), ",%u\n", (rounded));				\
251  }									\
252} while (0)
253
254/* Turn off svr4.h version, it chokes the old gas.  The old layout
255   works fine under new gas anyway. */
256#undef ASM_OUTPUT_ASCII
257
258/* How to output some space */
259#undef ASM_OUTPUT_SKIP
260#define ASM_OUTPUT_SKIP(FILE,SIZE) 					\
261do {									\
262  if (TARGET_ELF) {							\
263    fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE));			\
264  } else {								\
265    fprintf (FILE, "\t.space %u\n", (SIZE));				\
266  }									\
267} while (0)
268
269#undef ASM_OUTPUT_SOURCE_LINE
270#define ASM_OUTPUT_SOURCE_LINE(file, line)				\
271do {									\
272  static int sym_lineno = 1;						\
273  if (TARGET_ELF) {							\
274    fprintf (file, ".stabn 68,0,%d,.LM%d-", line, sym_lineno);		\
275    assemble_name (file, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
276    fprintf (file, "\n.LM%d:\n", sym_lineno);				\
277    sym_lineno += 1;							\
278  } else {								\
279    fprintf (file, "\t%s %d,0,%d\n", ASM_STABD_OP, N_SLINE, lineno);	\
280  }									\
281} while (0)
282
283#undef DBX_FUNCTION_FIRST
284#define DBX_CHECK_FUNCTION_FIRST TARGET_ELF
285
286/* stabs-in-elf has offsets relative to function beginning */
287#undef DBX_OUTPUT_LBRAC
288#define DBX_OUTPUT_LBRAC(file,name)					\
289do {									\
290  fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC);		\
291  assemble_name (asmfile, buf);						\
292  if (TARGET_ELF) {							\
293    fputc ('-', asmfile);						\
294    assemble_name (asmfile, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
295  }									\
296  fprintf (asmfile, "\n");						\
297} while (0)
298
299#undef DBX_OUTPUT_RBRAC
300#define DBX_OUTPUT_RBRAC(file,name)					\
301do {									\
302  fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC);		\
303  assemble_name (asmfile, buf);						\
304  if (TARGET_ELF) {							\
305    fputc ('-', asmfile);						\
306    assemble_name (asmfile, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
307  }									\
308  fprintf (asmfile, "\n");						\
309} while (0)
310
311
312/* Define macro used to output shift-double opcodes when the shift
313   count is in %cl.  Some assemblers require %cl as an argument;
314   some don't.
315
316   *OLD* GAS requires the %cl argument, so override i386/unix.h. */
317
318#undef AS3_SHIFT_DOUBLE
319#define AS3_SHIFT_DOUBLE(a,b,c,d) AS3 (a,b,c,d)
320
321/* Indicate that jump tables go in the text section.  This is
322   necessary when compiling PIC code.  */
323#define JUMP_TABLES_IN_TEXT_SECTION
324
325/* override the exception table positioning */
326#define EXCEPTION_SECTION_FUNCTION \
327do {									\
328  if (TARGET_ELF) {							\
329    named_section (NULL_TREE, ".gcc_except_table");			\
330  } else {								\
331    if (flag_pic)							\
332      data_section ();							\
333    else								\
334      readonly_data_section ();						\
335  }									\
336} while (0);
337
338/* supply our own hook for calling __main() from main() */
339#define GEN_CALL__MAIN \
340  do {									\
341    if (!(TARGET_ELF))							\
342      emit_library_call (gen_rtx (SYMBOL_REF, Pmode, NAME__MAIN), 0,	\
343			 VOIDmode, 0);					\
344  } while (0)
345
346/* Map i386 registers to the numbers dwarf expects.  Of course this is different
347   from what stabs expects.  */
348
349#undef DWARF_DBX_REGISTER_NUMBER
350#define DWARF_DBX_REGISTER_NUMBER(n) \
351((n) == 0 ? 0 \
352 : (n) == 1 ? 2 \
353 : (n) == 2 ? 1 \
354 : (n) == 3 ? 3 \
355 : (n) == 4 ? 6 \
356 : (n) == 5 ? 7 \
357 : (n) == 6 ? 5 \
358 : (n) == 7 ? 4 \
359 : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
360 : (-1))
361
362/* Now what stabs expects in the register.  */
363#define STABS_DBX_REGISTER_NUMBER(n) \
364((n) == 0 ? 0 : \
365 (n) == 1 ? 2 : \
366 (n) == 2 ? 1 : \
367 (n) == 3 ? 3 : \
368 (n) == 4 ? 6 : \
369 (n) == 5 ? 7 : \
370 (n) == 6 ? 4 : \
371 (n) == 7 ? 5 : \
372 (n) + 4)
373
374#undef  DBX_REGISTER_NUMBER
375#define DBX_REGISTER_NUMBER(n)	((write_symbols == DWARF_DEBUG)	\
376				? DWARF_DBX_REGISTER_NUMBER(n)	\
377				: STABS_DBX_REGISTER_NUMBER(n))
378
379/* Tell final.c that we don't need a label passed to mcount.  */
380#define NO_PROFILE_DATA
381
382/* Output assembler code to FILE to increment profiler label # LABELNO
383   for profiling a function entry.  */
384/* Redefine this to not pass an unused label in %edx.  */
385
386#undef FUNCTION_PROFILER
387#define FUNCTION_PROFILER(FILE, LABELNO)  \
388{									\
389  if (flag_pic)								\
390    fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n");			\
391  else									\
392    fprintf (FILE, "\tcall mcount\n");					\
393}
394
395#define FUNCTION_PROFILER_EPILOGUE(FILE)  \
396{									\
397  if (TARGET_PROFILER_EPILOGUE)						\
398    {									\
399      if (flag_pic)							\
400	fprintf (FILE, "\tcall *mexitcount@GOT(%%ebx)\n");		\
401      else								\
402	fprintf (FILE, "\tcall mexitcount\n");				\
403    }									\
404}
405
406#undef SIZE_TYPE
407#define SIZE_TYPE "unsigned int"
408
409#undef PTRDIFF_TYPE
410#define PTRDIFF_TYPE "int"
411
412#undef WCHAR_TYPE
413#define WCHAR_TYPE "int"
414
415#define WCHAR_UNSIGNED 0
416
417#undef WCHAR_TYPE_SIZE
418#define WCHAR_TYPE_SIZE BITS_PER_WORD
419
420/* FREEBSD_NATIVE is defined when gcc is integrated into the FreeBSD
421   source tree so it can be configured appropriately without using
422   the GNU configure/build mechanism. */
423
424#ifdef FREEBSD_NATIVE
425
426/* Look for the include files in the system-defined places.  */
427
428#define GPLUSPLUS_INCLUDE_DIR		"/usr/include/g++"
429
430#define GCC_INCLUDE_DIR			"/usr/include"
431
432/* FreeBSD has GCC_INCLUDE_DIR first.  */
433#define INCLUDE_DEFAULTS		\
434  {					\
435    { GCC_INCLUDE_DIR, 0, 0 },		\
436    { GPLUSPLUS_INCLUDE_DIR, 1, 1 },	\
437    { 0, 0, 0 }				\
438  }
439
440/* Under FreeBSD, the normal location of the compiler back ends is the
441   /usr/libexec directory.  */
442
443#define STANDARD_EXEC_PREFIX		"/usr/libexec/"
444
445/* Under FreeBSD, the normal location of the various *crt*.o files is the
446   /usr/lib directory.  */
447
448#define STANDARD_STARTFILE_PREFIX	"/usr/lib/"
449
450/* On FreeBSD, gcc is called 'cc' */
451#define GCC_NAME			"cc"
452
453/* FreeBSD is 4.4BSD derived */
454#define bsd4_4
455
456#endif /* FREEBSD_NATIVE */
457
458#undef CPP_PREDEFINES
459#define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__=3 -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
460
461#undef CPP_SPEC
462#if TARGET_CPU_DEFAULT == 2
463#define CPP_SPEC "\
464%{!maout: -D__ELF__} \
465%{munderscores: -D__UNDERSCORES__} \
466%{maout: %{!mno-underscores: -D__UNDERSCORES__}} \
467%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__}"
468#else
469#define CPP_SPEC "\
470%{!maout: -D__ELF__} \
471%{munderscores: -D__UNDERSCORES__} \
472%{maout: %{!mno-underscores: -D__UNDERSCORES__}} \
473%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{m486:-D__i486__}"
474#endif
475
476#undef CC1_SPEC
477#define CC1_SPEC "\
478%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
479%{maout: %{!mno-underscores: %{!munderscores: -munderscores }}}"
480
481#undef  ASM_SPEC
482#define ASM_SPEC	"%{v*: -v} %{maout: %{fpic:-k} %{fPIC:-k}}"
483
484/* Like the default, except no -lg, and no -p.  */
485#undef LIB_SPEC
486#define LIB_SPEC "%{!shared:%{!pg:%{!pthread:%{!kthread:-lc}%{kthread:-lpthread -lc}}%{pthread:-lc_r}}%{pg:%{!pthread:%{!kthread:-lc_r}%{kthread:-lpthread_p -lc_p}}%{pthread:-lc_r_p}}}"
487
488/* Let gcc locate this for us according to the -m rules */
489#undef  LIBGCC_SPEC
490#define LIBGCC_SPEC "%{!shared:libgcc.a%s}"
491
492/* Provide a LINK_SPEC appropriate for FreeBSD.  Here we provide support
493   for the special GCC options -static and -shared, which allow us to
494   link things in one of these three modes by applying the appropriate
495   combinations of options at link-time. We like to support here for
496   as many of the other GNU linker options as possible. But I don't
497   have the time to search for those flags. I am sure how to add
498   support for -soname shared_object_name. H.J.
499
500   When the -shared link option is used a final link is not being
501   done.  */
502
503#undef	LINK_SPEC
504#define LINK_SPEC "\
505 %{p:%e`-p' not supported; use `-pg' and gprof(1)} \
506  %{maout: %{shared:-Bshareable} \
507    %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
508      %{pg:-Bstatic} %{Z}} \
509    %{assert*} %{R*}} \
510  %{!maout: \
511    -m elf_i386 \
512    %{Wl,*:%*} \
513    %{assert*} %{R*} %{rpath*} %{defsym*} \
514    %{shared:-Bshared %{h*} %{soname*}} \
515    %{symbolic:-Bsymbolic} \
516    %{!shared: \
517      %{!static: \
518	%{rdynamic: -export-dynamic} \
519	%{!dynamic-linker: -dynamic-linker /usr/libexec/ld-elf.so.1}} \
520      %{static:-Bstatic}}}"
521
522/* Get perform_* macros to build libgcc.a.  */
523#include "i386/perform.h"
524
525#undef STARTFILE_SPEC
526#define STARTFILE_SPEC "\
527  %{maout: %{shared:c++rt0.o%s} \
528    %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}} \
529  %{!maout:  %{!shared: \
530    %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \
531    crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
532
533#undef  ENDFILE_SPEC
534#define ENDFILE_SPEC \
535  "%{!maout: %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s}"
536
537/* This goes away when the math emulator is fixed.  */
538#undef TARGET_DEFAULT
539#define TARGET_DEFAULT	(MASK_NO_FANCY_MATH_387 | 0301)
540
541#define HAVE_ATEXIT
542#define HAVE_PUTENV
543
544/* to assist building libgcc2.c */
545#ifndef __ELF__
546#undef OBJECT_FORMAT_ELF
547#endif
548