1/* Definitions for ELF assembler support.
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/* So we can conditionalize small amounts of code in pa.cc or pa.md.  */
21#define OBJ_ELF
22
23#define ENDFILE_SPEC "crtend.o%s"
24
25#define STARTFILE_SPEC "%{!shared: \
26			 %{!symbolic: \
27			  %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\
28			crtbegin.o%s"
29
30#define TEXT_SECTION_ASM_OP "\t.text"
31#define DATA_SECTION_ASM_OP "\t.data"
32#define BSS_SECTION_ASM_OP "\t.section\t.bss"
33
34#define TARGET_ASM_FILE_START pa_elf_file_start
35
36#undef ASM_DECLARE_FUNCTION_NAME
37#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
38do {  \
39  if (TREE_PUBLIC (DECL)) \
40    { \
41      fputs ("\t.EXPORT ", FILE); \
42      assemble_name (FILE, NAME); \
43      fputs (",ENTRY\n", FILE); \
44    } \
45   } while (0)
46
47/* This is how to output a command to make the user-level label
48   named NAME defined for reference from other files.  We use
49   assemble_name_raw instead of assemble_name since a symbol in
50   a .IMPORT directive that isn't otherwise referenced is not
51   placed in the symbol table of the assembled object.
52
53   Failure to import a function reference can cause the HP linker
54   to segmentation fault!
55
56   Note that the SOM based tools need the symbol imported as a
57   CODE symbol, while the ELF based tools require the symbol to
58   be imported as an ENTRY symbol.  */
59
60#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
61  pa_hpux_asm_output_external ((FILE), (DECL), (NAME))
62#define ASM_OUTPUT_EXTERNAL_REAL(FILE, DECL, NAME) \
63  do { fputs ("\t.IMPORT ", FILE);					\
64       assemble_name_raw (FILE, NAME);					\
65       if (FUNCTION_NAME_P (NAME))     					\
66	 fputs (",ENTRY\n", FILE);					\
67       else								\
68	 fputs (",DATA\n", FILE);					\
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	 pa_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