1/* Definitions for PA_RISC with ELF format
2   Copyright 1999, 2000, 2001, 2002, 2003 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 2, 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 COPYING.  If not, write to
18the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19Boston, MA 02110-1301, USA.  */
20
21
22#undef TARGET_OS_CPP_BUILTINS
23#define TARGET_OS_CPP_BUILTINS()		\
24  do						\
25    {						\
26	LINUX_TARGET_OS_CPP_BUILTINS();		\
27	builtin_assert ("machine=bigendian");	\
28	if (flag_pic)				\
29	  {					\
30		builtin_define ("__PIC__");	\
31		builtin_define ("__pic__");	\
32	  }					\
33    }						\
34  while (0)
35
36#undef CPP_SPEC
37#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
38
39#undef	LIB_SPEC
40#define LIB_SPEC \
41  "%{pthread:-lpthread} \
42   %{shared:-lgcc -lc} \
43   %{!shared:%{mieee-fp:-lieee} %{shared-libgcc:-lgcc} %{profile:-lc_p}%{!profile:-lc}}"
44
45#undef ASM_SPEC
46#define ASM_SPEC \
47  "%{v:-V} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
48
49/* Define this for shared library support because it isn't in the main
50   linux.h file.  */
51
52#undef LINK_SPEC
53#define LINK_SPEC "\
54  %{shared:-shared} \
55  %{!shared: \
56    %{!static: \
57      %{rdynamic:-export-dynamic} \
58      %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
59      %{static:-static}}"
60
61/* glibc's profiling functions don't need gcc to allocate counters.  */
62#define NO_DEFERRED_PROFILE_COUNTERS 1
63
64/* Define the strings used for the special svr4 .type and .size directives.
65   These strings generally do not vary from one system running svr4 to
66   another, but if a given system (e.g. m88k running svr) needs to use
67   different pseudo-op names for these, they may be overridden in the
68   file which includes this one.  */
69
70#undef STRING_ASM_OP
71#define STRING_ASM_OP   ".stringz"
72
73#define TEXT_SECTION_ASM_OP "\t.text"
74#define DATA_SECTION_ASM_OP "\t.data"
75#define BSS_SECTION_ASM_OP "\t.section\t.bss"
76
77#define TARGET_ASM_FILE_START pa_linux_file_start
78
79/* We want local labels to start with period if made with asm_fprintf.  */
80#undef LOCAL_LABEL_PREFIX
81#define LOCAL_LABEL_PREFIX "."
82
83/* Define these to generate the Linux/ELF/SysV style of internal
84   labels all the time - i.e. to be compatible with
85   ASM_GENERATE_INTERNAL_LABEL in <elfos.h>.  Compare these with the
86   ones in pa.h and note the lack of dollar signs in these.  FIXME:
87   shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */
88
89#undef ASM_OUTPUT_ADDR_VEC_ELT
90#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
91  if (TARGET_BIG_SWITCH)					\
92    fprintf (FILE, "\t.word .L%d\n", VALUE);			\
93  else								\
94    fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
95
96#undef ASM_OUTPUT_ADDR_DIFF_ELT
97#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
98  if (TARGET_BIG_SWITCH)					\
99    fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL);		\
100  else								\
101    fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
102
103/* Use the default.  */
104#undef ASM_OUTPUT_LABEL
105
106/* NOTE: (*targetm.asm_out.internal_label)() is defined for us by elfos.h, and
107   does what we want (i.e. uses colons).  It must be compatible with
108   ASM_GENERATE_INTERNAL_LABEL(), so do not define it here.  */
109
110/* Use the default.  */
111#undef ASM_OUTPUT_INTERNAL_LABEL
112
113/* Use the default.  */
114#undef TARGET_ASM_GLOBALIZE_LABEL
115/* Globalizing directive for a label.  */
116#define GLOBAL_ASM_OP ".globl "
117
118/* FIXME: Hacked from the <elfos.h> one so that we avoid multiple
119   labels in a function declaration (since pa.c seems determined to do
120   it differently)  */
121
122#undef ASM_DECLARE_FUNCTION_NAME
123#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
124  do								\
125    {								\
126      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
127      ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
128    }								\
129  while (0)
130
131/* As well as globalizing the label, we need to encode the label
132   to ensure a plabel is generated in an indirect call.  */
133
134#undef ASM_OUTPUT_EXTERNAL_LIBCALL
135#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)  		\
136  do								\
137    {								\
138      if (!FUNCTION_NAME_P (XSTR (FUN, 0)))			\
139	hppa_encode_label (FUN);				\
140      (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0));	\
141    }								\
142  while (0)
143
144/* Linux always uses gas.  */
145#undef TARGET_GAS
146#define TARGET_GAS 1
147