1/* Definitions for PA_RISC with ELF format
2   Copyright (C) 1999-2022 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 3, or (at your option)
9any later version.
10
11GCC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along 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	NETBSD_OS_CPP_BUILTINS_ELF();	\
26	builtin_assert ("machine=bigendian");	\
27    }						\
28  while (0)
29
30#undef CPP_SPEC
31#define CPP_SPEC NETBSD_CPP_SPEC
32
33#undef ASM_SPEC
34#define ASM_SPEC \
35  "%{v:-V} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
36
37#undef EXTRA_SPECS
38#define EXTRA_SPECS NETBSD_SUBTARGET_EXTRA_SPECS
39#undef SUBTARGET_EXTRA_SPECS
40
41#define NETBSD_ENTRY_POINT "__start"
42
43#undef LINK_SPEC
44#define LINK_SPEC NETBSD_LINK_SPEC_ELF
45
46/* NetBSD profiling functions don't need gcc to allocate counters.  */
47#define NO_DEFERRED_PROFILE_COUNTERS 1
48
49/* Define the strings used for the special svr4 .type and .size directives.
50   These strings generally do not vary from one system running svr4 to
51   another, but if a given system (e.g. m88k running svr) needs to use
52   different pseudo-op names for these, they may be overridden in the
53   file which includes this one.  */
54
55#undef STRING_ASM_OP
56#define STRING_ASM_OP   "\t.stringz\t"
57
58#define TEXT_SECTION_ASM_OP "\t.text"
59#define DATA_SECTION_ASM_OP "\t.data"
60#define BSS_SECTION_ASM_OP "\t.section\t.bss"
61
62#define TARGET_ASM_FILE_START pa_linux_file_start
63
64/* We want local labels to start with period if made with asm_fprintf.  */
65#undef LOCAL_LABEL_PREFIX
66#define LOCAL_LABEL_PREFIX "."
67
68/* Define these to generate the Linux/ELF/SysV style of internal
69   labels all the time - i.e. to be compatible with
70   ASM_GENERATE_INTERNAL_LABEL in <elfos.h>.  Compare these with the
71   ones in pa.h and note the lack of dollar signs in these.  FIXME:
72   shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */
73
74#undef ASM_OUTPUT_ADDR_VEC_ELT
75#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
76  fprintf (FILE, "\t.word .L%d\n", VALUE)
77
78#undef ASM_OUTPUT_ADDR_DIFF_ELT
79#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
80  fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
81
82/* Use the default.  */
83#undef ASM_OUTPUT_LABEL
84
85/* NOTE: (*targetm.asm_out.internal_label)() is defined for us by elfos.h, and
86   does what we want (i.e. uses colons).  It must be compatible with
87   ASM_GENERATE_INTERNAL_LABEL(), so do not define it here.  */
88
89/* Use the default.  */
90#undef ASM_OUTPUT_INTERNAL_LABEL
91
92/* Use the default.  */
93#undef TARGET_ASM_GLOBALIZE_LABEL
94/* Globalizing directive for a label.  */
95#define GLOBAL_ASM_OP ".globl "
96
97/* FIXME: Hacked from the <elfos.h> one so that we avoid multiple
98   labels in a function declaration (since pa.cc seems determined to do
99   it differently)  */
100
101#undef ASM_DECLARE_FUNCTION_NAME
102#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
103  do								\
104    {								\
105      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
106      ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
107    }								\
108  while (0)
109
110/* As well as globalizing the label, we need to encode the label
111   to ensure a plabel is generated in an indirect call.  */
112
113#undef ASM_OUTPUT_EXTERNAL_LIBCALL
114#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)  		\
115  do								\
116    {								\
117      if (!FUNCTION_NAME_P (XSTR (FUN, 0)))			\
118	pa_encode_label (FUN);					\
119      (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0));	\
120    }								\
121  while (0)
122
123/* NetBSD always uses gas.  */
124#undef TARGET_GAS
125#define TARGET_GAS 1
126
127/* Use long int for these type to make hppa64 compatibility easier.  */
128#undef SIZE_TYPE
129#define SIZE_TYPE "long unsigned int"
130
131#undef PTRDIFF_TYPE
132#define PTRDIFF_TYPE "long int"
133
134/* NetBSD always uses 128 bits / 16 byte alignment.  */
135#undef MALLOC_ABI_ALIGNMENT
136#define MALLOC_ABI_ALIGNMENT 128
137
138#if 0
139#undef TARGET_SYNC_LIBCALL
140#define TARGET_SYNC_LIBCALL 1
141#endif
142