OSDN Git Service

2001-08-01 H.J. Lu <hjl@gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / config / a29k / udi.h
1 /* Definitions of target machine for GNU compiler, for AMD Am29000 CPU
2    running over UDI using COFF.
3    Copyright (C) 1994, 1996, 2000 Free Software Foundation, Inc.
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 /* Support the ctors and dtors sections for g++.  */
23
24 #define CTORS_SECTION_ASM_OP    "\t.use .ctors"
25 #define DTORS_SECTION_ASM_OP    "\t.use .dtors"
26
27 /* A list of other sections which the compiler might be "in" at any
28    given time.  */
29
30 #undef EXTRA_SECTIONS
31 #define EXTRA_SECTIONS readonly_data, in_ctors, in_dtors
32
33 /* A list of extra section function definitions.  */
34
35 #undef EXTRA_SECTION_FUNCTIONS
36 #define EXTRA_SECTION_FUNCTIONS                                         \
37   READONLY_DATA_FUNCTION                                                \
38   CTORS_SECTION_FUNCTION                                                \
39   DTORS_SECTION_FUNCTION
40
41 #define READONLY_DATA_FUNCTION                                  \
42 void                                                            \
43 literal_section ()                                              \
44 {                                                               \
45   if (in_section != readonly_data)                              \
46     {                                                           \
47       fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP); \
48       in_section = readonly_data;                               \
49     }                                                           \
50 }                                                               \
51
52 #define CTORS_SECTION_FUNCTION                                          \
53 void                                                                    \
54 ctors_section ()                                                        \
55 {                                                                       \
56   if (in_section != in_ctors)                                           \
57     {                                                                   \
58       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);             \
59       in_section = in_ctors;                                            \
60     }                                                                   \
61 }
62
63 #define DTORS_SECTION_FUNCTION                                          \
64 void                                                                    \
65 dtors_section ()                                                        \
66 {                                                                       \
67   if (in_section != in_dtors)                                           \
68     {                                                                   \
69       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);             \
70       in_section = in_dtors;                                            \
71     }                                                                   \
72 }
73
74 #define INT_ASM_OP "\t.word\t"
75
76 /* A C statement (sans semicolon) to output an element in the table of
77    global constructors.  */
78 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)                               \
79   do {                                                                  \
80     ctors_section ();                                                   \
81     fprintf (FILE, "%s", INT_ASM_OP);                                   \
82     assemble_name (FILE, NAME);                                         \
83     fprintf (FILE, "\n");                                               \
84   } while (0)
85
86 /* A C statement (sans semicolon) to output an element in the table of
87    global destructors.  */
88 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                                \
89   do {                                                                  \
90     dtors_section ();                                                   \
91     fprintf (FILE, "%s", INT_ASM_OP);                                   \
92     assemble_name (FILE, NAME);                                         \
93     fprintf (FILE, "\n");                                               \
94   } while (0)