OSDN Git Service

* gcc/config/arm/t-arm (MD_INCLUDES): Ensure all md files are listed.
[pf3gnuchains/gcc-fork.git] / gcc / config / arm / pe.h
1 /* Definitions of target machine for GNU compiler, for ARM with PE obj format.
2    Copyright (C) 1995, 1996, 1999, 2000, 2002, 2003, 2004, 2005, 2007, 2011
3    Free Software Foundation, Inc.
4    Contributed by Doug Evans (dje@cygnus.com).
5    
6    This file is part of GCC.
7
8    GCC is free software; you can redistribute it and/or modify it
9    under the terms of the GNU General Public License as published
10    by the Free Software Foundation; either version 3, or (at your
11    option) any later version.
12
13    GCC is distributed in the hope that it will be useful, but WITHOUT
14    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16    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 /* Enable PE specific code.  */
23 #define ARM_PE          1
24
25 #define ARM_PE_FLAG_CHAR '@'
26
27 /* Ensure that @x. will be stripped from the function name.  */
28 #undef SUBTARGET_NAME_ENCODING_LENGTHS
29 #define SUBTARGET_NAME_ENCODING_LENGTHS  \
30   case ARM_PE_FLAG_CHAR: return 3;
31
32 #undef  USER_LABEL_PREFIX
33 #define USER_LABEL_PREFIX "_"
34
35 \f
36 /* Run-time Target Specification.  */
37
38 /* Get tree.c to declare a target-specific specialization of
39    merge_decl_attributes.  */
40 #define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
41
42 #undef  SUBTARGET_CPP_SPEC
43 #define SUBTARGET_CPP_SPEC "-D__pe__"
44
45 #undef  TARGET_DEFAULT
46 #define TARGET_DEFAULT  (MASK_NOP_FUN_DLLIMPORT)
47
48 #undef  MULTILIB_DEFAULTS
49 #define MULTILIB_DEFAULTS \
50   { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork" }  
51 \f
52 #undef  WCHAR_TYPE
53 #define WCHAR_TYPE      "short unsigned int"
54 #undef  WCHAR_TYPE_SIZE
55 #define WCHAR_TYPE_SIZE 16
56
57 /* r11 is fixed.  */
58 #undef  SUBTARGET_CONDITIONAL_REGISTER_USAGE
59 #define SUBTARGET_CONDITIONAL_REGISTER_USAGE \
60   fixed_regs [11] = 1; \
61   call_used_regs [11] = 1;
62
63 \f
64 /* PE/COFF uses explicit import from shared libraries.  */
65 #define MULTIPLE_SYMBOL_SPACES 1
66
67 #define TARGET_ASM_UNIQUE_SECTION arm_pe_unique_section
68 #define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
69
70 #define SUPPORTS_ONE_ONLY 1
71
72 /* Switch into a generic section.  */
73 #undef  TARGET_ASM_NAMED_SECTION
74 #define TARGET_ASM_NAMED_SECTION  default_pe_asm_named_section
75 \f
76 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
77
78 /* Output a reference to a label.  */
79 #undef  ASM_OUTPUT_LABELREF
80 #define ASM_OUTPUT_LABELREF(STREAM, NAME)  \
81   asm_fprintf (STREAM, "%U%s", arm_strip_name_encoding (NAME))
82
83 /* Output a function definition label.  */
84 #undef  ASM_DECLARE_FUNCTION_NAME
85 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL)           \
86   do                                                            \
87     {                                                           \
88       if (arm_dllexport_name_p (NAME))                          \
89         {                                                       \
90           drectve_section ();                                   \
91           fprintf (STREAM, "\t.ascii \" -export:%s\"\n",        \
92                    arm_strip_name_encoding (NAME));             \
93           switch_to_section (function_section (DECL));          \
94         }                                                       \
95       ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL);           \
96       if (TARGET_THUMB)                                         \
97         fprintf (STREAM, "\t.code 16\n");                       \
98       ASM_OUTPUT_LABEL (STREAM, NAME);                          \
99     }                                                           \
100   while (0)
101
102 /* Output a common block.  */
103 #undef  ASM_OUTPUT_COMMON
104 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED)  \
105   do                                                    \
106     {                                                   \
107       if (arm_dllexport_name_p (NAME))                  \
108         {                                               \
109           drectve_section ();                           \
110           fprintf ((STREAM), "\t.ascii \" -export:%s\"\n",\
111                    arm_strip_name_encoding (NAME));     \
112         }                                               \
113       if (! arm_dllimport_name_p (NAME))                \
114         {                                               \
115           fprintf ((STREAM), "\t.comm\t");              \
116           assemble_name ((STREAM), (NAME));             \
117           asm_fprintf ((STREAM), ", %d\t%@ %d\n",       \
118                    (int)(ROUNDED), (int)(SIZE));        \
119         }                                               \
120     }                                                   \
121   while (0)
122
123 /* Output the label for an initialized variable.  */
124 #undef  ASM_DECLARE_OBJECT_NAME
125 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)     \
126   do                                                    \
127     {                                                   \
128       if (arm_dllexport_name_p (NAME))                  \
129         {                                               \
130           section *save_section = in_section;           \
131           drectve_section ();                           \
132           fprintf (STREAM, "\t.ascii \" -export:%s\"\n",\
133                    arm_strip_name_encoding (NAME));     \
134           switch_to_section (save_section);             \
135         }                                               \
136       ASM_OUTPUT_LABEL ((STREAM), (NAME));              \
137     }                                                   \
138   while (0)
139 \f
140 /* Support the ctors/dtors and other sections.  */
141
142 #define DRECTVE_SECTION_ASM_OP  "\t.section .drectve"
143
144 #define drectve_section() \
145   (fprintf (asm_out_file, "%s\n", DRECTVE_SECTION_ASM_OP), \
146    in_section = NULL)