xref: /openbsd/gnu/gcc/gcc/config/pa/openbsd.h (revision 17df1aa7)
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 
34 /* Run-time target specifications. */
35 #undef TARGET_OS_CPP_BUILTINS
36 #define TARGET_OS_CPP_BUILTINS()		\
37   do						\
38     {						\
39 	OPENBSD_OS_CPP_BUILTINS_ELF();		\
40     }						\
41   while (0)
42 
43 /* Define the strings used for the special svr4 .type and .size directives.
44    These strings generally do not vary from one system running svr4 to
45    another, but if a given system (e.g. m88k running svr) needs to use
46    different pseudo-op names for these, they may be overridden in the
47    file which includes this one.  */
48 
49 #undef STRING_ASM_OP
50 #define STRING_ASM_OP   "\t.stringz\t"
51 
52 #define TEXT_SECTION_ASM_OP "\t.text"
53 #define DATA_SECTION_ASM_OP "\t.data"
54 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
55 
56 /* We want local labels to start with period if made with asm_fprintf.  */
57 #undef LOCAL_LABEL_PREFIX
58 #define LOCAL_LABEL_PREFIX "."
59 
60 /* Define these to generate the Linux/ELF/SysV style of internal
61    labels all the time - i.e. to be compatible with
62    ASM_GENERATE_INTERNAL_LABEL in <elfos.h>.  Compare these with the
63    ones in pa.h and note the lack of dollar signs in these.  FIXME:
64    shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */
65 
66 #undef ASM_OUTPUT_ADDR_VEC_ELT
67 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
68   if (TARGET_BIG_SWITCH)					\
69     fprintf (FILE, "\t.word .L%d\n", VALUE);			\
70   else								\
71     fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
72 
73 #undef ASM_OUTPUT_ADDR_DIFF_ELT
74 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
75   if (TARGET_BIG_SWITCH)					\
76     fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL);		\
77   else								\
78     fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
79 
80 /* Use the default.  */
81 #undef ASM_OUTPUT_LABEL
82 
83 /* NOTE: (*targetm.asm_out.internal_label)() is defined for us by elfos.h, and
84    does what we want (i.e. uses colons).  It must be compatible with
85    ASM_GENERATE_INTERNAL_LABEL(), so do not define it here.  */
86 
87 /* Use the default.  */
88 #undef ASM_OUTPUT_INTERNAL_LABEL
89 
90 /* Use the default.  */
91 #undef TARGET_ASM_GLOBALIZE_LABEL
92 
93 /* FIXME: Hacked from the <elfos.h> one so that we avoid multiple
94    labels in a function declaration (since pa.c seems determined to do
95    it differently)  */
96 
97 #undef ASM_DECLARE_FUNCTION_NAME
98 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
99   do								\
100     {								\
101       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
102       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
103     }								\
104   while (0)
105 
106 /* As well as globalizing the label, we need to encode the label
107    to ensure a plabel is generated in an indirect call.  */
108 
109 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
110 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)			\
111   do								\
112     {								\
113       if (!FUNCTION_NAME_P (XSTR (FUN, 0)))			\
114         hppa_encode_label (FUN);				\
115       (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0));	\
116     }								\
117   while (0)
118 
119 /* OpenBSD always uses gas. */
120 #undef TARGET_GAS
121 #define TARGET_GAS 1
122 
123 /* XXX OpenBSD/hppa has a non-standard .comm */
124 
125 #undef ASM_OUTPUT_ALIGNED_COMMON
126 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)  		\
127   do									\
128     {									\
129       switch_to_section (bss_section);					\
130       assemble_name((FILE), (NAME));					\
131       fprintf ((FILE), "\t.comm %d\n",					\
132 	       MAX ((SIZE), ((ALIGN) / BITS_PER_UNIT)));		\
133     }									\
134   while (0)
135 
136 #undef ASM_OUTPUT_ALIGNED_LOCAL
137 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)  		\
138   do									\
139     {									\
140       switch_to_section (bss_section);					\
141       fprintf((FILE), "\t.align %d\n", ((ALIGN) / BITS_PER_UNIT));	\
142       assemble_name((FILE), (NAME));					\
143       fprintf ((FILE), "\t.block %d\n",	(SIZE));			\
144     }									\
145   while (0)
146 
147 #undef TARGET_SCHED_DEFAULT
148 #define TARGET_SCHED_DEFAULT PROCESSOR_700
149 
150 /* XXX Why doesn't PA support -R  like everyone ??? */
151 #undef LINK_SPEC
152 #define LINK_SPEC \
153   "%{EB} %{EL} %{shared} %{non_shared} \
154    %{call_shared} %{no_archive} %{exact_version} \
155    %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
156    %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \
157    %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \
158    %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
159 
160 /* Layout of source language data types. */
161 
162 /* This must agree with <machine/_types.h> */
163 #undef SIZE_TYPE
164 #define SIZE_TYPE "long unsigned int"
165 
166 #undef PTRDIFF_TYPE
167 #define PTRDIFF_TYPE "long int"
168 
169 #undef INTMAX_TYPE
170 #define INTMAX_TYPE "long long int"
171 
172 #undef UINTMAX_TYPE
173 #define UINTMAX_TYPE "long long unsigned int"
174 
175 #undef WCHAR_TYPE
176 #define WCHAR_TYPE "int"
177 
178 #undef WCHAR_TYPE_SIZE
179 #define WCHAR_TYPE_SIZE 32
180 
181 /* As an elf system, we need crtbegin/crtend stuff.  */
182 #undef STARTFILE_SPEC
183 #define STARTFILE_SPEC "%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} crtbegin%O%s} %{shared:crtbeginS%O%s}"
184 #undef ENDFILE_SPEC
185 #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
186