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	GNU_USER_TARGET_OS_CPP_BUILTINS();	\
26	builtin_assert ("machine=bigendian");	\
27    }						\
28  while (0)
29
30#undef CPP_SPEC
31#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
32
33#undef ASM_SPEC
34#define ASM_SPEC \
35  ""
36
37/* Define this for shared library support because it isn't in the main
38   linux.h file.  */
39
40#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
41
42#undef LINK_SPEC
43#define LINK_SPEC "\
44  %{shared:-shared} \
45  %{!shared: \
46    %{!static: \
47      %{rdynamic:-export-dynamic} \
48      -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
49      %{static:-static}}"
50
51/* glibc's profiling functions don't need gcc to allocate counters.  */
52#define NO_DEFERRED_PROFILE_COUNTERS 1
53
54/* Define the strings used for the special svr4 .type and .size directives.
55   These strings generally do not vary from one system running svr4 to
56   another, but if a given system (e.g. m88k running svr) needs to use
57   different pseudo-op names for these, they may be overridden in the
58   file which includes this one.  */
59
60#undef STRING_ASM_OP
61#define STRING_ASM_OP   "\t.stringz\t"
62
63#define TEXT_SECTION_ASM_OP "\t.text"
64#define DATA_SECTION_ASM_OP "\t.data"
65#define BSS_SECTION_ASM_OP "\t.section\t.bss"
66
67#define TARGET_ASM_FILE_START pa_linux_file_start
68
69/* We want local labels to start with period if made with asm_fprintf.  */
70#undef LOCAL_LABEL_PREFIX
71#define LOCAL_LABEL_PREFIX "."
72
73/* Define these to generate the Linux/ELF/SysV style of internal
74   labels all the time - i.e. to be compatible with
75   ASM_GENERATE_INTERNAL_LABEL in <elfos.h>.  Compare these with the
76   ones in pa.h and note the lack of dollar signs in these.  FIXME:
77   shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */
78
79#undef ASM_OUTPUT_ADDR_VEC_ELT
80#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
81  fprintf (FILE, "\t.word .L%d\n", VALUE)
82
83#undef ASM_OUTPUT_ADDR_DIFF_ELT
84#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
85  fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
86
87/* Use the default.  */
88#undef ASM_OUTPUT_LABEL
89
90/* NOTE: (*targetm.asm_out.internal_label)() is defined for us by elfos.h, and
91   does what we want (i.e. uses colons).  It must be compatible with
92   ASM_GENERATE_INTERNAL_LABEL(), so do not define it here.  */
93
94/* Use the default.  */
95#undef ASM_OUTPUT_INTERNAL_LABEL
96
97/* Use the default.  */
98#undef TARGET_ASM_GLOBALIZE_LABEL
99/* Globalizing directive for a label.  */
100#define GLOBAL_ASM_OP ".globl "
101
102/* FIXME: Hacked from the <elfos.h> one so that we avoid multiple
103   labels in a function declaration (since pa.cc seems determined to do
104   it differently).  */
105
106#undef ASM_DECLARE_FUNCTION_NAME
107#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
108  do								\
109    {								\
110      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
111      ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
112      pa_output_function_label (FILE);				\
113    }								\
114  while (0)
115
116/* Output function prologue for linux.  */
117#undef TARGET_ASM_FUNCTION_PROLOGUE
118#define TARGET_ASM_FUNCTION_PROLOGUE pa_linux_output_function_prologue
119
120/* As well as globalizing the label, we need to encode the label
121   to ensure a plabel is generated in an indirect call.  */
122
123#undef ASM_OUTPUT_EXTERNAL_LIBCALL
124#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)  		\
125  do								\
126    {								\
127      if (!FUNCTION_NAME_P (XSTR (FUN, 0)))			\
128	pa_encode_label (FUN);					\
129      (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0));	\
130    }								\
131  while (0)
132
133#undef TARGET_GAS
134#define TARGET_GAS 1
135
136#undef TARGET_SYNC_LIBCALL
137#define TARGET_SYNC_LIBCALL 1
138
139/* The SYNC operations are implemented as library functions, not
140   INSN patterns.  As a result, the HAVE defines for the patterns are
141   not defined.  We need to define them to generate the corresponding
142   __GCC_HAVE_SYNC_COMPARE_AND_SWAP_* and __GCC_ATOMIC_*_LOCK_FREE
143   defines.  */
144
145#define HAVE_sync_compare_and_swapqi 1
146#define HAVE_sync_compare_and_swaphi 1
147#define HAVE_sync_compare_and_swapsi 1
148#define HAVE_sync_compare_and_swapdi 1
149
150/* It's not possible to enable GNU_stack notes since the kernel needs
151   an executable stack for signal returns and syscall restarts.  */
152
153#undef NEED_INDICATE_EXEC_STACK
154#define NEED_INDICATE_EXEC_STACK 0
155