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).
6 This file is part of GCC.
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.
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.
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/>. */
22 /* Enable PE specific code. */
25 #define ARM_PE_FLAG_CHAR '@'
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;
32 #undef USER_LABEL_PREFIX
33 #define USER_LABEL_PREFIX "_"
36 /* Run-time Target Specification. */
38 /* Get tree.c to declare a target-specific specialization of
39 merge_decl_attributes. */
40 #define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
42 #undef SUBTARGET_CPP_SPEC
43 #define SUBTARGET_CPP_SPEC "-D__pe__"
46 #define TARGET_DEFAULT (MASK_NOP_FUN_DLLIMPORT)
48 #undef MULTILIB_DEFAULTS
49 #define MULTILIB_DEFAULTS \
50 { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork" }
53 #define WCHAR_TYPE "short unsigned int"
54 #undef WCHAR_TYPE_SIZE
55 #define WCHAR_TYPE_SIZE 16
58 #undef SUBTARGET_CONDITIONAL_REGISTER_USAGE
59 #define SUBTARGET_CONDITIONAL_REGISTER_USAGE \
60 fixed_regs [11] = 1; \
61 call_used_regs [11] = 1;
64 /* PE/COFF uses explicit import from shared libraries. */
65 #define MULTIPLE_SYMBOL_SPACES 1
67 #define TARGET_ASM_UNIQUE_SECTION arm_pe_unique_section
68 #define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
70 #define SUPPORTS_ONE_ONLY 1
72 /* Switch into a generic section. */
73 #undef TARGET_ASM_NAMED_SECTION
74 #define TARGET_ASM_NAMED_SECTION default_pe_asm_named_section
76 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
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))
83 /* Output a function definition label. */
84 #undef ASM_DECLARE_FUNCTION_NAME
85 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
88 if (arm_dllexport_name_p (NAME)) \
91 fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \
92 arm_strip_name_encoding (NAME)); \
93 switch_to_section (function_section (DECL)); \
95 ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL); \
97 fprintf (STREAM, "\t.code 16\n"); \
98 ASM_OUTPUT_LABEL (STREAM, NAME); \
102 /* Output a common block. */
103 #undef ASM_OUTPUT_COMMON
104 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
107 if (arm_dllexport_name_p (NAME)) \
109 drectve_section (); \
110 fprintf ((STREAM), "\t.ascii \" -export:%s\"\n",\
111 arm_strip_name_encoding (NAME)); \
113 if (! arm_dllimport_name_p (NAME)) \
115 fprintf ((STREAM), "\t.comm\t"); \
116 assemble_name ((STREAM), (NAME)); \
117 asm_fprintf ((STREAM), ", %d\t%@ %d\n", \
118 (int)(ROUNDED), (int)(SIZE)); \
123 /* Output the label for an initialized variable. */
124 #undef ASM_DECLARE_OBJECT_NAME
125 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
128 if (arm_dllexport_name_p (NAME)) \
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); \
136 ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
140 /* Support the ctors/dtors and other sections. */
142 #define DRECTVE_SECTION_ASM_OP "\t.section .drectve"
144 #define drectve_section() \
145 (fprintf (asm_out_file, "%s\n", DRECTVE_SECTION_ASM_OP), \