xref: /openbsd/gnu/gcc/gcc/config/pa/openbsd.h (revision 25bd9554)
1 /* Configuration file for an hppa risc OpenBSD target.
2 
3    Copyright (C) 1999 Free Software Foundation, Inc.
4 
5 This file is part of GNU CC.
6 
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11 
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21 
22 
23 #include <pa/pa32-regs.h>
24 #define OBSD_HAS_DECLARE_FUNCTION_NAME
25 #define OBSD_HAS_DECLARE_FUNCTION_SIZE
26 #define OBSD_HAS_DECLARE_OBJECT
27 #include <openbsd.h>
28 
29 /* Turn off various SOM crap we don't want.  */
30 #undef TARGET_ELF32
31 #define TARGET_ELF32 1
32 
33 #undef MAX_OFILE_ALIGNMENT
34 #define MAX_OFILE_ALIGNMENT 0x8000
35 
36 /* Run-time target specifications. */
37 #undef TARGET_OS_CPP_BUILTINS
38 #define TARGET_OS_CPP_BUILTINS()		\
39   do						\
40     {						\
41 	OPENBSD_OS_CPP_BUILTINS_ELF();		\
42     }						\
43   while (0)
44 
45 /* We don't use profile counters.  */
46 #define NO_DEFERRED_PROFILE_COUNTERS 1
47 
48 /* Define the strings used for the special svr4 .type and .size directives.
49    These strings generally do not vary from one system running svr4 to
50    another, but if a given system (e.g. m88k running svr) needs to use
51    different pseudo-op names for these, they may be overridden in the
52    file which includes this one.  */
53 
54 #undef STRING_ASM_OP
55 #define STRING_ASM_OP   "\t.stringz\t"
56 
57 #define TEXT_SECTION_ASM_OP "\t.text"
58 #define DATA_SECTION_ASM_OP "\t.data"
59 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
60 
61 /* We want local labels to start with period if made with asm_fprintf.  */
62 #undef LOCAL_LABEL_PREFIX
63 #define LOCAL_LABEL_PREFIX "."
64 
65 /* Define these to generate the Linux/ELF/SysV style of internal
66    labels all the time - i.e. to be compatible with
67    ASM_GENERATE_INTERNAL_LABEL in <elfos.h>.  Compare these with the
68    ones in pa.h and note the lack of dollar signs in these.  FIXME:
69    shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */
70 
71 #undef ASM_OUTPUT_ADDR_VEC_ELT
72 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
73   if (TARGET_BIG_SWITCH)					\
74     fprintf (FILE, "\t.word .L%d\n", VALUE);			\
75   else								\
76     fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
77 
78 #undef ASM_OUTPUT_ADDR_DIFF_ELT
79 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
80   if (TARGET_BIG_SWITCH)					\
81     fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL);		\
82   else								\
83     fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
84 
85 /* Use the default.  */
86 #undef ASM_OUTPUT_LABEL
87 
88 /* NOTE: (*targetm.asm_out.internal_label)() is defined for us by elfos.h, and
89    does what we want (i.e. uses colons).  It must be compatible with
90    ASM_GENERATE_INTERNAL_LABEL(), so do not define it here.  */
91 
92 /* Use the default.  */
93 #undef ASM_OUTPUT_INTERNAL_LABEL
94 
95 /* Use the default.  */
96 #undef TARGET_ASM_GLOBALIZE_LABEL
97 
98 /* FIXME: Hacked from the <elfos.h> one so that we avoid multiple
99    labels in a function declaration (since pa.c seems determined to do
100    it differently)  */
101 
102 #undef ASM_DECLARE_FUNCTION_NAME
103 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
104   do								\
105     {								\
106       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
107       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
108     }								\
109   while (0)
110 
111 /* As well as globalizing the label, we need to encode the label
112    to ensure a plabel is generated in an indirect call.  */
113 
114 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
115 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)			\
116   do								\
117     {								\
118       if (!FUNCTION_NAME_P (XSTR (FUN, 0)))			\
119         hppa_encode_label (FUN);				\
120       (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0));	\
121     }								\
122   while (0)
123 
124 /* OpenBSD always uses gas. */
125 #undef TARGET_GAS
126 #define TARGET_GAS 1
127 
128 /* XXX OpenBSD/hppa has a non-standard .comm */
129 
130 #undef ASM_OUTPUT_ALIGNED_COMMON
131 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)  		\
132   do									\
133     {									\
134       switch_to_section (bss_section);					\
135       assemble_name((FILE), (NAME));					\
136       fprintf((FILE), "\t.align %d\n", ((ALIGN) / BITS_PER_UNIT));	\
137       fprintf ((FILE), "\t.comm %d\n",					\
138 	       MAX ((SIZE), ((ALIGN) / BITS_PER_UNIT)));		\
139     }									\
140   while (0)
141 
142 #undef ASM_OUTPUT_ALIGNED_LOCAL
143 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)  		\
144   do									\
145     {									\
146       switch_to_section (bss_section);					\
147       fprintf((FILE), "\t.align %d\n", ((ALIGN) / BITS_PER_UNIT));	\
148       assemble_name((FILE), (NAME));					\
149       fprintf ((FILE), "\t.block %d\n",	(SIZE));			\
150     }									\
151   while (0)
152 
153 #undef TARGET_SCHED_DEFAULT
154 #define TARGET_SCHED_DEFAULT PROCESSOR_700
155 
156 #undef LINK_SPEC
157 #define LINK_SPEC \
158   "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
159    %{shared:-shared} %{R*} \
160    %{static:-Bstatic} \
161    %{!static:-Bdynamic} \
162    %{rdynamic:-export-dynamic} \
163    %{assert*} \
164    %{!static:%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}}"
165 
166 /* Layout of source language data types. */
167 
168 /* This must agree with <machine/_types.h> */
169 #undef SIZE_TYPE
170 #define SIZE_TYPE "long unsigned int"
171 
172 #undef PTRDIFF_TYPE
173 #define PTRDIFF_TYPE "long int"
174 
175 #undef INTMAX_TYPE
176 #define INTMAX_TYPE "long long int"
177 
178 #undef UINTMAX_TYPE
179 #define UINTMAX_TYPE "long long unsigned int"
180 
181 #undef WCHAR_TYPE
182 #define WCHAR_TYPE "int"
183 
184 #undef WCHAR_TYPE_SIZE
185 #define WCHAR_TYPE_SIZE 32
186 
187 #undef JUMP_TABLES_DEFAULT
188 #define JUMP_TABLES_DEFAULT 0	/* incompatible with --executable-text */
189 
190 /* As an elf system, we need crtbegin/crtend stuff.  */
191 #undef STARTFILE_SPEC
192 #define STARTFILE_SPEC "\
193 	%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} \
194 	%{!p:%{!static:crt0%O%s} %{static:%{nopie:crt0%O%s} \
195 	%{!nopie:rcrt0%O%s}}}} crtbegin%O%s} %{shared:crtbeginS%O%s}"
196 #undef ENDFILE_SPEC
197 #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
198