110d565efSmrg /* Target definitions for GNU compiler for SPARC running System V.4
2*ec02198aSmrg    Copyright (C) 1991-2020 Free Software Foundation, Inc.
310d565efSmrg    Contributed by Ron Guilmette (rfg@monkeys.com).
410d565efSmrg 
510d565efSmrg This file is part of GCC.
610d565efSmrg 
710d565efSmrg GCC is free software; you can redistribute it and/or modify
810d565efSmrg it under the terms of the GNU General Public License as published by
910d565efSmrg the Free Software Foundation; either version 3, or (at your option)
1010d565efSmrg any later version.
1110d565efSmrg 
1210d565efSmrg GCC is distributed in the hope that it will be useful,
1310d565efSmrg but WITHOUT ANY WARRANTY; without even the implied warranty of
1410d565efSmrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1510d565efSmrg GNU General Public License for more details.
1610d565efSmrg 
1710d565efSmrg You should have received a copy of the GNU General Public License
1810d565efSmrg along with GCC; see the file COPYING3.  If not see
1910d565efSmrg <http://www.gnu.org/licenses/>.  */
2010d565efSmrg 
2110d565efSmrg #undef SIZE_TYPE
2210d565efSmrg #define SIZE_TYPE (TARGET_ARCH64 ? "long unsigned int" : "unsigned int")
2310d565efSmrg 
2410d565efSmrg #undef PTRDIFF_TYPE
2510d565efSmrg #define PTRDIFF_TYPE (TARGET_ARCH64 ? "long int" : "int")
2610d565efSmrg 
2710d565efSmrg /* Undefined some symbols which are appropriate only for typical svr4
2810d565efSmrg    systems, but not for the specific case of svr4 running on a
2910d565efSmrg    SPARC.  */
3010d565efSmrg 
3110d565efSmrg #undef INIT_SECTION_ASM_OP
3210d565efSmrg #undef FINI_SECTION_ASM_OP
3310d565efSmrg #undef READONLY_DATA_SECTION_ASM_OP
3410d565efSmrg #undef TYPE_OPERAND_FMT
3510d565efSmrg #undef STRING_ASM_OP
3610d565efSmrg #undef COMMON_ASM_OP
3710d565efSmrg #undef SKIP_ASM_OP
3810d565efSmrg #undef SET_ASM_OP	/* Has no equivalent.  See ASM_OUTPUT_DEF below.  */
3910d565efSmrg 
4010d565efSmrg /* Pass -K to the assembler when PIC.  */
4110d565efSmrg #undef ASM_SPEC
4210d565efSmrg #define ASM_SPEC \
4310d565efSmrg   "%{v:-V} %{Qy:} %{!Qn:-Qy} %{Ym,*} \
4410d565efSmrg    %{" FPIE_OR_FPIC_SPEC ":-K PIC} %(asm_cpu)"
4510d565efSmrg 
4610d565efSmrg /* Define the names of various pseudo-op used by the SPARC/svr4 assembler.
4710d565efSmrg    Note that many of these are different from the typical pseudo-ops used
4810d565efSmrg    by most svr4 assemblers.  That is probably due to a (misguided?) attempt
4910d565efSmrg    to keep the SPARC/svr4 assembler somewhat compatible with the SPARC/SunOS
5010d565efSmrg    assembler.  */
5110d565efSmrg 
5210d565efSmrg #define STRING_ASM_OP		"\t.asciz\t"
5310d565efSmrg #define COMMON_ASM_OP		"\t.common\t"
5410d565efSmrg #define SKIP_ASM_OP		"\t.skip\t"
5510d565efSmrg 
5610d565efSmrg /* This is the format used to print the second operand of a .type pseudo-op
5710d565efSmrg    for the SPARC/svr4 assembler.  */
5810d565efSmrg 
5910d565efSmrg #define TYPE_OPERAND_FMT      "#%s"
6010d565efSmrg 
6110d565efSmrg #undef ASM_OUTPUT_CASE_LABEL
6210d565efSmrg #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE)		\
6310d565efSmrg do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3);		\
6410d565efSmrg      (*targetm.asm_out.internal_label) ((FILE), PREFIX, NUM);		\
6510d565efSmrg    } while (0)
6610d565efSmrg 
6710d565efSmrg /* This is how to equate one symbol to another symbol.  The syntax used is
6810d565efSmrg    `SYM1=SYM2'.  Note that this is different from the way equates are done
6910d565efSmrg    with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'.  */
7010d565efSmrg 
7110d565efSmrg #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)				\
7210d565efSmrg  do {	fprintf ((FILE), "\t");						\
7310d565efSmrg 	assemble_name (FILE, LABEL1);					\
7410d565efSmrg 	fprintf (FILE, " = ");						\
7510d565efSmrg 	assemble_name (FILE, LABEL2);					\
7610d565efSmrg 	fprintf (FILE, "\n");						\
7710d565efSmrg   } while (0)
7810d565efSmrg 
7910d565efSmrg /* A set of symbol definitions for assembly pseudo-ops which will
8010d565efSmrg    get us switched to various sections of interest.  These are used
8110d565efSmrg    in all places where we simply want to switch to a section, and
8210d565efSmrg    *not* to push the previous section name onto the assembler's
8310d565efSmrg    section names stack (as we do often in dwarfout.c).  */
8410d565efSmrg 
8510d565efSmrg #define TEXT_SECTION_ASM_OP	"\t.section\t\".text\""
8610d565efSmrg #define DATA_SECTION_ASM_OP	"\t.section\t\".data\""
8710d565efSmrg #define BSS_SECTION_ASM_OP	"\t.section\t\".bss\""
8810d565efSmrg #define READONLY_DATA_SECTION_ASM_OP "\t.section\t\".rodata\""
8910d565efSmrg #define INIT_SECTION_ASM_OP	"\t.section\t\".init\""
9010d565efSmrg #define FINI_SECTION_ASM_OP	"\t.section\t\".fini\""
9110d565efSmrg 
9210d565efSmrg /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
9310d565efSmrg 
9410d565efSmrg    Note that we want to give these sections the SHF_WRITE attribute
9510d565efSmrg    because these sections will actually contain data (i.e. tables of
9610d565efSmrg    addresses of functions in the current root executable or shared library
9710d565efSmrg    file) and, in the case of a shared library, the relocatable addresses
9810d565efSmrg    will have to be properly resolved/relocated (and then written into) by
9910d565efSmrg    the dynamic linker when it actually attaches the given shared library
10010d565efSmrg    to the executing process.  (Note that on SVR4, you may wish to use the
10110d565efSmrg    `-z text' option to the ELF linker, when building a shared library, as
10210d565efSmrg    an additional check that you are doing everything right.  But if you do
10310d565efSmrg    use the `-z text' option when building a shared library, you will get
10410d565efSmrg    errors unless the .ctors and .dtors sections are marked as writable
10510d565efSmrg    via the SHF_WRITE attribute.)  */
10610d565efSmrg 
10710d565efSmrg #undef CTORS_SECTION_ASM_OP
10810d565efSmrg #define CTORS_SECTION_ASM_OP    "\t.section\t\".ctors\",#alloc,#write"
10910d565efSmrg #undef DTORS_SECTION_ASM_OP
11010d565efSmrg #define DTORS_SECTION_ASM_OP    "\t.section\t\".dtors\",#alloc,#write"
11110d565efSmrg 
11210d565efSmrg #undef ASM_OUTPUT_ALIGNED_BSS
11310d565efSmrg #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
11410d565efSmrg   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
11510d565efSmrg 
11610d565efSmrg /* Override the name of the mcount profiling function.  */
11710d565efSmrg 
11810d565efSmrg #undef MCOUNT_FUNCTION
11910d565efSmrg #define MCOUNT_FUNCTION "*_mcount"
120