0
|
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
|
|
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
|
|
36 /* Run-time Target Specification. */
|
|
37 #undef TARGET_VERSION
|
|
38 #define TARGET_VERSION fputs (" (ARM/pe)", stderr)
|
|
39
|
|
40 /* Get tree.c to declare a target-specific specialization of
|
|
41 merge_decl_attributes. */
|
|
42 #define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
|
|
43
|
|
44 #undef SUBTARGET_CPP_SPEC
|
|
45 #define SUBTARGET_CPP_SPEC "-D__pe__"
|
|
46
|
|
47 #undef TARGET_DEFAULT
|
|
48 #define TARGET_DEFAULT (MASK_NOP_FUN_DLLIMPORT)
|
|
49
|
|
50 #undef MULTILIB_DEFAULTS
|
|
51 #define MULTILIB_DEFAULTS \
|
|
52 { "marm", "mlittle-endian", "msoft-float", "mno-thumb-interwork" }
|
|
53
|
|
54 #undef WCHAR_TYPE
|
|
55 #define WCHAR_TYPE "short unsigned int"
|
|
56 #undef WCHAR_TYPE_SIZE
|
|
57 #define WCHAR_TYPE_SIZE 16
|
|
58
|
|
59 /* r11 is fixed. */
|
|
60 #undef SUBTARGET_CONDITIONAL_REGISTER_USAGE
|
|
61 #define SUBTARGET_CONDITIONAL_REGISTER_USAGE \
|
|
62 fixed_regs [11] = 1; \
|
|
63 call_used_regs [11] = 1;
|
|
64
|
|
65
|
|
66 /* PE/COFF uses explicit import from shared libraries. */
|
|
67 #define MULTIPLE_SYMBOL_SPACES 1
|
|
68
|
|
69 #define TARGET_ASM_UNIQUE_SECTION arm_pe_unique_section
|
|
70 #define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
|
|
71
|
|
72 #define SUPPORTS_ONE_ONLY 1
|
|
73
|
|
74 /* Switch into a generic section. */
|
|
75 #undef TARGET_ASM_NAMED_SECTION
|
|
76 #define TARGET_ASM_NAMED_SECTION default_pe_asm_named_section
|
|
77
|
|
78 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
|
|
79
|
|
80 /* Output a reference to a label. */
|
|
81 #undef ASM_OUTPUT_LABELREF
|
|
82 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
|
|
83 asm_fprintf (STREAM, "%U%s", arm_strip_name_encoding (NAME))
|
|
84
|
|
85 /* Output a function definition label. */
|
|
86 #undef ASM_DECLARE_FUNCTION_NAME
|
|
87 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
|
|
88 do \
|
|
89 { \
|
|
90 if (arm_dllexport_name_p (NAME)) \
|
|
91 { \
|
|
92 drectve_section (); \
|
|
93 fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
|
|
94 arm_strip_name_encoding (NAME)); \
|
|
95 switch_to_section (function_section (DECL)); \
|
|
96 } \
|
|
97 ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL); \
|
|
98 if (TARGET_THUMB) \
|
|
99 fprintf (STREAM, "\t.code 16\n"); \
|
|
100 ASM_OUTPUT_LABEL (STREAM, NAME); \
|
|
101 } \
|
|
102 while (0)
|
|
103
|
|
104 /* Output a common block. */
|
|
105 #undef ASM_OUTPUT_COMMON
|
|
106 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
|
|
107 do \
|
|
108 { \
|
|
109 if (arm_dllexport_name_p (NAME)) \
|
|
110 { \
|
|
111 drectve_section (); \
|
|
112 fprintf ((STREAM), "\t.ascii \" -export:%s\"\n",\
|
|
113 arm_strip_name_encoding (NAME)); \
|
|
114 } \
|
|
115 if (! arm_dllimport_name_p (NAME)) \
|
|
116 { \
|
|
117 fprintf ((STREAM), "\t.comm\t"); \
|
|
118 assemble_name ((STREAM), (NAME)); \
|
|
119 asm_fprintf ((STREAM), ", %d\t%@ %d\n", \
|
|
120 (int)(ROUNDED), (int)(SIZE)); \
|
|
121 } \
|
|
122 } \
|
|
123 while (0)
|
|
124
|
|
125 /* Output the label for an initialized variable. */
|
|
126 #undef ASM_DECLARE_OBJECT_NAME
|
|
127 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
|
|
128 do \
|
|
129 { \
|
|
130 if (arm_dllexport_name_p (NAME)) \
|
|
131 { \
|
|
132 section *save_section = in_section; \
|
|
133 drectve_section (); \
|
|
134 fprintf (STREAM, "\t.ascii \" -export:%s\"\n",\
|
|
135 arm_strip_name_encoding (NAME)); \
|
|
136 switch_to_section (save_section); \
|
|
137 } \
|
|
138 ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
|
|
139 } \
|
|
140 while (0)
|
|
141
|
|
142 /* Support the ctors/dtors and other sections. */
|
|
143
|
|
144 #define DRECTVE_SECTION_ASM_OP "\t.section .drectve"
|
|
145
|
|
146 #define drectve_section() \
|
|
147 (fprintf (asm_out_file, "%s\n", DRECTVE_SECTION_ASM_OP), \
|
|
148 in_section = NULL)
|