1/* Definitions for ELF assembler support.
2   Copyright (C) 1999, 2003, 2005 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/* So we can conditionalize small amounts of code in pa.c or pa.md.  */
22#define OBJ_ELF
23
24#define ENDFILE_SPEC "crtend.o%s"
25
26#define STARTFILE_SPEC "%{!shared: \
27			 %{!symbolic: \
28			  %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\
29			crtbegin.o%s"
30
31#define TEXT_SECTION_ASM_OP "\t.text"
32#define DATA_SECTION_ASM_OP "\t.data"
33#define BSS_SECTION_ASM_OP "\t.section\t.bss"
34
35#define TARGET_ASM_FILE_START pa_elf_file_start
36
37#undef ASM_DECLARE_FUNCTION_NAME
38#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
39do {  \
40  if (TREE_PUBLIC (DECL)) \
41    { \
42      fputs ("\t.EXPORT ", FILE); \
43      assemble_name (FILE, NAME); \
44      fputs (",ENTRY\n", FILE); \
45    } \
46   } while (0)
47
48/* This is how to output a command to make the user-level label
49   named NAME defined for reference from other files.  We use
50   assemble_name_raw instead of assemble_name since a symbol in
51   a .IMPORT directive that isn't otherwise referenced is not
52   placed in the symbol table of the assembled object.
53
54   Failure to import a function reference can cause the HP linker
55   to segmentation fault!
56
57   Note that the SOM based tools need the symbol imported as a
58   CODE symbol, while the ELF based tools require the symbol to
59   be imported as an ENTRY symbol.  */
60
61#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
62  pa_hpux_asm_output_external ((FILE), (DECL), (NAME))
63#define ASM_OUTPUT_EXTERNAL_REAL(FILE, DECL, NAME) \
64  do { fputs ("\t.IMPORT ", FILE);					\
65       assemble_name_raw (FILE, NAME);					\
66       if (FUNCTION_NAME_P (NAME))     					\
67	 fputs (",ENTRY\n", FILE);					\
68       else								\
69	 fputs (",DATA\n", FILE);					\
70     } while (0)
71
72/* The bogus HP assembler requires ALL external references to be
73   "imported", even library calls. They look a bit different, so
74   here's this macro.
75
76   Also note not all libcall names are passed to
77   targetm.encode_section_info (__main for example).  To make sure all
78   libcall names have section info recorded in them, we do it here.  */
79
80#undef ASM_OUTPUT_EXTERNAL_LIBCALL
81#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, RTL) \
82  do { fputs ("\t.IMPORT ", FILE);					\
83       if (!function_label_operand (RTL, VOIDmode))			\
84	 hppa_encode_label (RTL);					\
85       assemble_name (FILE, XSTR ((RTL), 0));		       		\
86       fputs (",ENTRY\n", FILE);					\
87     } while (0)
88
89/* Biggest alignment supported by the object file format of this
90   machine.  Use this macro to limit the alignment which can be
91   specified using the `__attribute__ ((aligned (N)))' construct.  If
92   not defined, the default value is `BIGGEST_ALIGNMENT'.  */
93#define MAX_OFILE_ALIGNMENT (32768 * 8)
94