OSDN Git Service

* doc/extend.texi (AVR Built-in Functions): Document
[pf3gnuchains/gcc-fork.git] / gcc / config / mcore / mcore-elf.h
1 /* Definitions of MCore target. 
2    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2007, 2011
3    Free Software Foundation, Inc.
4    Contributed by Cygnus Solutions.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22 #ifndef __MCORE_ELF_H__
23 #define __MCORE_ELF_H__
24
25 /* Use DWARF2 debugging info.  */
26 #define DWARF2_DEBUGGING_INFO 1
27
28 #undef  PREFERRED_DEBUGGING_TYPE
29 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
30
31 #define MCORE_EXPORT_NAME(STREAM, NAME)                 \
32   do                                                    \
33     {                                                   \
34       fprintf (STREAM, "\t.section .exports\n");        \
35       fprintf (STREAM, "\t.ascii \" -export:%s\"\n",    \
36                (* targetm.strip_name_encoding) (NAME)); \
37       in_section = NULL;                                \
38     }                                                   \
39   while (0);
40
41 /* Write the extra assembler code needed to declare a function properly.
42    Some svr4 assemblers need to also have something extra said about the
43    function's return value.  We allow for that here.  */
44 #undef  ASM_DECLARE_FUNCTION_NAME
45 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)             \
46   do                                                            \
47     {                                                           \
48       if (mcore_dllexport_name_p (NAME))                        \
49         {                                                       \
50           MCORE_EXPORT_NAME (FILE, NAME);                       \
51           switch_to_section (function_section (DECL));          \
52         }                                                       \
53       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");       \
54       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));            \
55       ASM_OUTPUT_LABEL (FILE, NAME);                            \
56     }                                                           \
57   while (0)
58
59 /* Write the extra assembler code needed to declare an object properly.  */
60 #undef  ASM_DECLARE_OBJECT_NAME
61 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)               \
62   do                                                            \
63     {                                                           \
64       HOST_WIDE_INT size;                                       \
65       if (mcore_dllexport_name_p (NAME))                        \
66         {                                                       \
67           section *save_section = in_section;                   \
68           MCORE_EXPORT_NAME (FILE, NAME);                       \
69           switch_to_section (save_section);                     \
70         }                                                       \
71       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");         \
72       size_directive_output = 0;                                \
73       if (!flag_inhibit_size_directive && DECL_SIZE (DECL))     \
74         {                                                       \
75           size_directive_output = 1;                            \
76           size = int_size_in_bytes (TREE_TYPE (DECL));          \
77           ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size);         \
78         }                                                       \
79       ASM_OUTPUT_LABEL(FILE, NAME);                             \
80     }                                                           \
81   while (0)
82  
83 /* Output the size directive for a decl in rest_of_decl_compilation
84    in the case where we did not do so before the initializer.
85    Once we find the error_mark_node, we know that the value of
86    size_directive_output was set
87    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
88 #undef  ASM_FINISH_DECLARE_OBJECT
89 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)         \
90   do                                                                     \
91     {                                                                    \
92       const char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);           \
93       HOST_WIDE_INT size;                                                \
94       if (!flag_inhibit_size_directive && DECL_SIZE (DECL)               \
95           && ! AT_END && TOP_LEVEL                                       \
96           && DECL_INITIAL (DECL) == error_mark_node                      \
97           && !size_directive_output)                                     \
98         {                                                                \
99           size_directive_output = 1;                                     \
100           size = int_size_in_bytes (TREE_TYPE (DECL));                   \
101           ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size);                  \
102         }                                                                \
103     }                                                                    \
104   while (0)
105
106
107 #undef  STARTFILE_SPEC
108 #define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
109
110 /* Include the OS stub library, so that the code can be simulated.
111    This is not the right way to do this.  Ideally this kind of thing
112    should be done in the linker script - but I have not worked out how
113    to specify the location of a linker script in a gcc command line yet.  */
114 #undef  ENDFILE_SPEC
115 #define ENDFILE_SPEC  "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s"
116
117 /* The subroutine calls in the .init and .fini sections create literal
118    pools which must be jumped around....  */
119 #define FORCE_CODE_SECTION_ALIGN        asm ("br 1f ; .literals ; 1:");
120
121 #undef  CTORS_SECTION_ASM_OP
122 #define CTORS_SECTION_ASM_OP    "\t.section\t.ctors,\"aw\""
123 #undef  DTORS_SECTION_ASM_OP
124 #define DTORS_SECTION_ASM_OP    "\t.section\t.dtors,\"aw\""
125      
126 #endif /* __MCORE_ELF_H__ */