1/* Definitions of target machine for GNU compiler, for SPARClite w/o FPU, COFF.
2   Copyright (C) 1994, 1996 Free Software Foundation, Inc.
3   Written by Ken Raeburn (raeburn@cygnus.com).
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING.  If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA.  */
21
22#include "sparc/lite.h"
23
24#undef ASM_OUTPUT_IDENT
25
26#undef SELECT_SECTION
27#undef SELECT_RTX_SECTION
28#define BSS_SECTION_ASM_OP	".section\t\".bss\""
29
30#include "svr3.h"
31
32#undef CPP_PREDEFINES
33#define CPP_PREDEFINES "-Dsparc -Dsparclite -Acpu(sparc) -Amachine(sparc)"
34
35/* Default to stabs in COFF.  */
36
37#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
38
39#include "dbxcoff.h"
40
41/* Support the ctors and dtors sections for g++.  */
42
43#undef INIT_SECTION_ASM_OP
44
45/* Support the ctors and dtors sections for g++.  */
46
47#undef CTORS_SECTION_ASM_OP
48#define CTORS_SECTION_ASM_OP	".section\t.ctors,\"x\""
49#undef DTORS_SECTION_ASM_OP
50#define DTORS_SECTION_ASM_OP	".section\t.dtors,\"x\""
51
52/* A list of other sections which the compiler might be "in" at any
53   given time.  */
54
55#undef EXTRA_SECTIONS
56#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
57
58/* A list of extra section function definitions.  */
59
60#undef EXTRA_SECTION_FUNCTIONS
61#define EXTRA_SECTION_FUNCTIONS						\
62  CONST_SECTION_FUNCTION						\
63  CTORS_SECTION_FUNCTION						\
64  DTORS_SECTION_FUNCTION
65
66#define CTORS_SECTION_FUNCTION						\
67void									\
68ctors_section ()							\
69{									\
70  if (in_section != in_ctors)						\
71    {									\
72      fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);		\
73      in_section = in_ctors;						\
74    }									\
75}
76
77#define DTORS_SECTION_FUNCTION						\
78void									\
79dtors_section ()							\
80{									\
81  if (in_section != in_dtors)						\
82    {									\
83      fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);		\
84      in_section = in_dtors;						\
85    }									\
86}
87
88#define INT_ASM_OP ".long"
89
90/* A C statement (sans semicolon) to output an element in the table of
91   global constructors.  */
92#undef ASM_OUTPUT_CONSTRUCTOR
93#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)				\
94  do {									\
95    ctors_section ();							\
96    fprintf (FILE, "\t%s\t ", INT_ASM_OP);				\
97    assemble_name (FILE, NAME);						\
98    fprintf (FILE, "\n");						\
99  } while (0)
100
101/* A C statement (sans semicolon) to output an element in the table of
102   global destructors.  */
103#undef ASM_OUTPUT_DESTRUCTOR
104#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)       				\
105  do {									\
106    dtors_section ();                   				\
107    fprintf (FILE, "\t%s\t ", INT_ASM_OP);				\
108    assemble_name (FILE, NAME);              				\
109    fprintf (FILE, "\n");						\
110  } while (0)
111
112#undef DO_GLOBAL_CTORS_BODY
113#undef DO_GLOBAL_DTORS_BODY
114