1 /* Definitions for ELF assembler support.
2    Copyright (C) 1999, 2003 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 2, 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 COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, 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) \
39 do {  \
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 named NAME
49    defined for reference from other files.
50 
51    We call assemble_name, which in turn sets TREE_SYMBOL_REFERENCED.  This
52    macro will restore the original value of TREE_SYMBOL_REFERENCED to avoid
53    placing useless function definitions in the output file.
54 
55    Also note that the SOM based tools need the symbol imported as a CODE
56    symbol, while the ELF based tools require the symbol to be imported as
57    an ENTRY symbol.  What a crock.  */
58 
59 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)	\
60   do { int save_referenced;					\
61        save_referenced = TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)); \
62        fputs ("\t.IMPORT ", FILE);					\
63 	 assemble_name (FILE, NAME);				\
64        if (FUNCTION_NAME_P (NAME))     				\
65 	 fputs (",ENTRY\n", FILE);				\
66        else							\
67 	 fputs (",DATA\n", FILE);				\
68        TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)) = save_referenced; \
69      } while (0)
70 
71 /* The bogus HP assembler requires ALL external references to be
72    "imported", even library calls. They look a bit different, so
73    here's this macro.
74 
75    Also note not all libcall names are passed to
76    targetm.encode_section_info (__main for example).  To make sure all
77    libcall names have section info recorded in them, we do it here.  */
78 
79 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
80 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, RTL) \
81   do { fputs ("\t.IMPORT ", FILE);					\
82        if (!function_label_operand (RTL, VOIDmode))			\
83 	 hppa_encode_label (RTL);					\
84        assemble_name (FILE, XSTR ((RTL), 0));		       		\
85        fputs (",ENTRY\n", FILE);					\
86      } while (0)
87 
88 /* Biggest alignment supported by the object file format of this
89    machine.  Use this macro to limit the alignment which can be
90    specified using the `__attribute__ ((aligned (N)))' construct.  If
91    not defined, the default value is `BIGGEST_ALIGNMENT'.  */
92 #define MAX_OFILE_ALIGNMENT (32768 * 8)
93