1 /* Definitions for PA_RISC with ELF format
2    Copyright (C) 1999-2021 Free Software Foundation, Inc.
3 
4 This file is part of GCC.
5 
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
10 
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3.  If not see
18 <http://www.gnu.org/licenses/>.  */
19 
20 
21 #undef TARGET_OS_CPP_BUILTINS
22 #define TARGET_OS_CPP_BUILTINS()		\
23   do						\
24     {						\
25 	OPENBSD_OS_CPP_BUILTINS();		\
26 	builtin_assert ("machine=bigendian");	\
27     }						\
28   while (0)
29 
30 /* Our profiling scheme doesn't LP labels and counter words.  */
31 #define NO_DEFERRED_PROFILE_COUNTERS 1
32 
33 #undef STRING_ASM_OP
34 #define STRING_ASM_OP   "\t.stringz\t"
35 
36 #define TEXT_SECTION_ASM_OP "\t.text"
37 #define DATA_SECTION_ASM_OP "\t.data"
38 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
39 
40 /* We want local labels to start with period if made with asm_fprintf.  */
41 #undef LOCAL_LABEL_PREFIX
42 #define LOCAL_LABEL_PREFIX "."
43 
44 /* Define these to generate the Linux/ELF/SysV style of internal
45    labels all the time - i.e. to be compatible with
46    ASM_GENERATE_INTERNAL_LABEL in <elfos.h>.  Compare these with the
47    ones in pa.h and note the lack of dollar signs in these.  FIXME:
48    shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */
49 
50 #undef ASM_OUTPUT_ADDR_VEC_ELT
51 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
52   fprintf (FILE, "\t.word .L%d\n", VALUE)
53 
54 #undef ASM_OUTPUT_ADDR_DIFF_ELT
55 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
56   fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
57 
58 /* Use the default.  */
59 #undef ASM_OUTPUT_LABEL
60 
61 /* NOTE: (*targetm.asm_out.internal_label)() is defined for us by elfos.h, and
62    does what we want (i.e. uses colons).  It must be compatible with
63    ASM_GENERATE_INTERNAL_LABEL(), so do not define it here.  */
64 
65 /* Use the default.  */
66 #undef ASM_OUTPUT_INTERNAL_LABEL
67 
68 /* Use the default.  */
69 #undef TARGET_ASM_GLOBALIZE_LABEL
70 
71 /* FIXME: Hacked from the <elfos.h> one so that we avoid multiple
72    labels in a function declaration (since pa.c seems determined to do
73    it differently)  */
74 
75 #undef ASM_DECLARE_FUNCTION_NAME
76 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
77   do								\
78     {								\
79       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
80       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
81     }								\
82   while (0)
83 
84 /* As well as globalizing the label, we need to encode the label
85    to ensure a plabel is generated in an indirect call.  */
86 
87 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
88 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)  		\
89   do								\
90     {								\
91       if (!FUNCTION_NAME_P (XSTR (FUN, 0)))			\
92 	pa_encode_label (FUN);				\
93       (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0));	\
94     }								\
95   while (0)
96 
97 /* This says how to output an assembler line to define a global common symbol
98    with size SIZE (in bytes) and alignment ALIGN (in bits).  */
99 
100 #undef ASM_OUTPUT_ALIGNED_COMMON
101 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)  		\
102   pa_asm_output_aligned_common (FILE, NAME, SIZE, ALIGN)
103 
104 /* This says how to output an assembler line to define a local common symbol
105    with size SIZE (in bytes) and alignment ALIGN (in bits).  This macro
106    controls how the assembler definitions of uninitialized static variables
107    are output.  */
108 
109 #undef ASM_OUTPUT_ALIGNED_LOCAL
110 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)		\
111   pa_asm_output_aligned_local (FILE, NAME, SIZE, ALIGN)
112 
113 /* OpenBSD always uses gas.  */
114 #undef TARGET_GAS
115 #define TARGET_GAS 1
116 
117 /* Layout of source language data types. */
118 
119 /* This must agree with <machine/_types.h> */
120 #undef SIZE_TYPE
121 #define SIZE_TYPE "long unsigned int"
122 
123 #undef PTRDIFF_TYPE
124 #define PTRDIFF_TYPE "long int"
125 
126 #undef WCHAR_TYPE
127 #define WCHAR_TYPE "int"
128 
129 #undef WCHAR_TYPE_SIZE
130 #define WCHAR_TYPE_SIZE 32
131 
132 #undef WINT_TYPE
133 #define WINT_TYPE "int"
134 
135 #undef LINK_SPEC
136 #define LINK_SPEC \
137   "%{!shared:%{!nostdlib:%{!r:%{!e*:-e __start}}}} \
138    %{shared:-shared} %{R*} \
139    %{static:-Bstatic} \
140    %{!static:-Bdynamic} \
141    %{assert*} \
142    -dynamic-linker /usr/libexec/ld.so"
143 
144 #undef STARTFILE_SPEC
145 #define STARTFILE_SPEC "\
146 	%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
147 	crtbegin%O%s} %{shared:crtbeginS%O%s}"
148 
149 #undef ENDFILE_SPEC
150 #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
151 
152 #define OBSD_HAS_CORRECT_SPECS
153 
154 #define HAVE_ENABLE_EXECUTE_STACK
155