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