Annotation of gcc/config/sparc/sysv4.h, revision 1.1.1.4

1.1       root        1: /* Target definitions for GNU compiler for Sparc running System V.4
1.1.1.4 ! root        2:    Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
1.1       root        3: 
1.1.1.3   root        4:    Written by Ron Guilmette ([email protected]).
1.1       root        5: 
                      6: This file is part of GNU CC.
                      7: 
                      8: GNU CC is free software; you can redistribute it and/or modify
                      9: it under the terms of the GNU General Public License as published by
                     10: the Free Software Foundation; either version 2, or (at your option)
                     11: any later version.
                     12: 
                     13: GNU CC is distributed in the hope that it will be useful,
                     14: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     16: GNU General Public License for more details.
                     17: 
                     18: You should have received a copy of the GNU General Public License
                     19: along with GNU CC; see the file COPYING.  If not, write to
1.1.1.4 ! root       20: the Free Software Foundation, 59 Temple Place - Suite 330,
        !            21: Boston, MA 02111-1307, USA.  */
1.1       root       22: 
                     23: #include "sparc/sparc.h"
                     24: 
                     25: /* Undefine some symbols which are defined in "sparc.h" but which are
                     26:    appropriate only for SunOS 4.x, and not for svr4.  */
                     27: 
                     28: #undef WORD_SWITCH_TAKES_ARG
1.1.1.3   root       29: #undef ASM_OUTPUT_SOURCE_LINE
1.1       root       30: #undef SELECT_SECTION
                     31: #undef ASM_DECLARE_FUNCTION_NAME
                     32: #undef TEXT_SECTION_ASM_OP
                     33: #undef DATA_SECTION_ASM_OP
                     34: 
                     35: #include "svr4.h"
                     36: 
                     37: /* Undefined some symbols which are defined in "svr4.h" but which are
                     38:    appropriate only for typical svr4 systems, but not for the specific
                     39:    case of svr4 running on a Sparc.  */
                     40: 
                     41: #undef INIT_SECTION_ASM_OP
1.1.1.4 ! root       42: #undef FINI_SECTION_ASM_OP
1.1       root       43: #undef CONST_SECTION_ASM_OP
                     44: #undef TYPE_OPERAND_FMT
                     45: #undef PUSHSECTION_FORMAT
                     46: #undef STRING_ASM_OP
                     47: #undef COMMON_ASM_OP
                     48: #undef SKIP_ASM_OP
                     49: #undef SET_ASM_OP      /* Has no equivalent.  See ASM_OUTPUT_DEF below.  */
                     50: 
                     51: /* Provide a set of pre-definitions and pre-assertions appropriate for
                     52:    the Sparc running svr4.  __svr4__ is our extension.  */
                     53: 
                     54: #define CPP_PREDEFINES \
1.1.1.2   root       55:   "-Dsparc -Dunix -D__svr4__ \
                     56:    -Asystem(unix) -Asystem(svr4) -Acpu(sparc) -Amachine(sparc) \
1.1       root       57:    -D__GCC_NEW_VARARGS__"
                     58: 
1.1.1.3   root       59: /* The native assembler can't compute differences between symbols in different
                     60:    sections when generating pic code, so we must put jump tables in the
                     61:    text section.  */
                     62: #define JUMP_TABLES_IN_TEXT_SECTION 1
                     63: 
                     64: /* Pass -K to the assembler when PIC.  */
                     65: #undef ASM_SPEC
                     66: #define ASM_SPEC \
                     67:   "%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
                     68:    %{fpic:-K PIC} %{fPIC:-K PIC}"
                     69: 
                     70: /* Must use data section for relocatable constants when pic.  */
                     71: #undef SELECT_RTX_SECTION
                     72: #define SELECT_RTX_SECTION(MODE,RTX)           \
                     73: {                                              \
                     74:   if (flag_pic && symbolic_operand (RTX))      \
                     75:     data_section ();                           \
                     76:   else                                         \
                     77:     const_section ();                          \
                     78: }
                     79: 
1.1       root       80: /* This is the string used to begin an assembly language comment for the
                     81:    Sparc/svr4 assembler.  */
                     82: 
                     83: #define ASM_COMMENT_START "!"
                     84: 
                     85: /* Define the names of various pseudo-op used by the Sparc/svr4 assembler.
                     86:    Note that many of these are different from the typical pseudo-ops used
                     87:    by most svr4 assemblers.  That is probably due to a (misguided?) attempt
                     88:    to keep the Sparc/svr4 assembler somewhat compatible with the Sparc/SunOS
                     89:    assembler.  */
                     90: 
                     91: #define STRING_ASM_OP          ".asciz"
                     92: #define COMMON_ASM_OP          ".common"
                     93: #define SKIP_ASM_OP            ".skip"
                     94: #define UNALIGNED_INT_ASM_OP   ".uaword"
                     95: #define UNALIGNED_SHORT_ASM_OP ".uahalf"
                     96: #define PUSHSECTION_ASM_OP     ".pushsection"
                     97: #define POPSECTION_ASM_OP      ".popsection"
                     98: 
                     99: /* This is the format used to print the second operand of a .type pseudo-op
                    100:    for the Sparc/svr4 assembler.  */
                    101: 
                    102: #define TYPE_OPERAND_FMT      "#%s"
                    103: 
                    104: /* This is the format used to print a .pushsection pseudo-op (and its operand)
                    105:    for the Sparc/svr4 assembler.  */
                    106: 
                    107: #define PUSHSECTION_FORMAT     "\t%s\t\"%s\"\n"
                    108: 
                    109: #undef ASM_OUTPUT_CASE_LABEL
                    110: #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE)            \
1.1.1.3   root      111: do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3);               \
1.1       root      112:      ASM_OUTPUT_INTERNAL_LABEL ((FILE), PREFIX, NUM);                  \
                    113:    } while (0)
                    114: 
                    115: /* This is how to equate one symbol to another symbol.  The syntax used is
                    116:    `SYM1=SYM2'.  Note that this is different from the way equates are done
                    117:    with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'.  */
                    118: 
                    119: #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                             \
                    120:  do {  fprintf ((FILE), "\t");                                         \
                    121:        assemble_name (FILE, LABEL1);                                   \
                    122:        fprintf (FILE, " = ");                                          \
                    123:        assemble_name (FILE, LABEL2);                                   \
                    124:        fprintf (FILE, "\n");                                           \
                    125:   } while (0)
                    126: 
                    127: /* Define how the Sparc registers should be numbered for Dwarf output.
                    128:    The numbering provided here should be compatible with the native
                    129:    svr4 SDB debugger in the Sparc/svr4 reference port.  The numbering
                    130:    is as follows:
                    131: 
                    132:    Assembly name       gcc internal regno      Dwarf regno
                    133:    ----------------------------------------------------------
                    134:    g0-g7               0-7                     0-7
                    135:    o0-o7               8-15                    8-15
                    136:    l0-l7               16-23                   16-23
                    137:    i0-i7               24-31                   24-31
                    138:    f0-f31              32-63                   40-71
                    139: */
                    140: 
                    141: #define DBX_REGISTER_NUMBER(REGNO)                                     \
                    142:   (((REGNO) < 32) ? (REGNO)                                            \
                    143:    : ((REGNO) < 63) ? ((REGNO) + 8)                                    \
                    144:    : (abort (), 0))
                    145: 
                    146: /* A set of symbol definitions for assembly pseudo-ops which will
                    147:    get us switched to various sections of interest.  These are used
                    148:    in all places where we simply want to switch to a section, and
                    149:    *not* to push the previous section name onto the assembler's
                    150:    section names stack (as we do often in dwarfout.c).  */
                    151: 
                    152: #define TEXT_SECTION_ASM_OP    ".section\t\".text\""
                    153: #define DATA_SECTION_ASM_OP    ".section\t\".data\""
                    154: #define BSS_SECTION_ASM_OP     ".section\t\".bss\""
                    155: #define CONST_SECTION_ASM_OP   ".section\t\".rodata\""
1.1.1.3   root      156: #define INIT_SECTION_ASM_OP    ".section\t\".init\""
1.1.1.4 ! root      157: #define FINI_SECTION_ASM_OP    ".section\t\".fini\""
1.1.1.3   root      158: 
1.1.1.4 ! root      159: /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
        !           160:  
        !           161:    Note that we want to give these sections the SHF_WRITE attribute
        !           162:    because these sections will actually contain data (i.e. tables of
        !           163:    addresses of functions in the current root executable or shared library
        !           164:    file) and, in the case of a shared library, the relocatable addresses
        !           165:    will have to be properly resolved/relocated (and then written into) by
        !           166:    the dynamic linker when it actually attaches the given shared library
        !           167:    to the executing process.  (Note that on SVR4, you may wish to use the
        !           168:    `-z text' option to the ELF linker, when building a shared library, as
        !           169:    an additional check that you are doing everything right.  But if you do
        !           170:    use the `-z text' option when building a shared library, you will get
        !           171:    errors unless the .ctors and .dtors sections are marked as writable
        !           172:    via the SHF_WRITE attribute.)  */
        !           173:  
        !           174: #undef CTORS_SECTION_ASM_OP
        !           175: #define CTORS_SECTION_ASM_OP    ".section\t\".ctors\",#alloc,#write"
        !           176: #undef DTORS_SECTION_ASM_OP
        !           177: #define DTORS_SECTION_ASM_OP    ".section\t\".dtors\",#alloc,#write"
1.1       root      178: 
1.1.1.4 ! root      179: /* A C statement to output something to the assembler file to switch to section
        !           180:    NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
        !           181:    NULL_TREE.  Some target formats do not support arbitrary sections.  Do not
        !           182:    define this macro in such cases.  */
        !           183: 
        !           184: #undef ASM_OUTPUT_SECTION_NAME /* Override svr4.h's definition.  */
        !           185: #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
        !           186: do {                                                                   \
        !           187:   if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL)                     \
        !           188:     fprintf (FILE, ".section\t\"%s\",#alloc,#execinstr\n", (NAME));    \
        !           189:   else if ((DECL) && TREE_READONLY (DECL))                             \
        !           190:     fprintf (FILE, ".section\t\"%s\",#alloc\n", (NAME));               \
        !           191:   else                                                                 \
        !           192:     fprintf (FILE, ".section\t\"%s\",#alloc,#write\n", (NAME));                \
        !           193: } while (0)
1.1       root      194: 
                    195: /* This is how to output assembly code to define a `float' constant.
                    196:    We always have to use a .long pseudo-op to do this because the native
                    197:    SVR4 ELF assembler is buggy and it generates incorrect values when we
                    198:    try to use the .float pseudo-op instead.  */
                    199: 
                    200: #undef ASM_OUTPUT_FLOAT
                    201: #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                   \
                    202: do { long value;                                                       \
                    203:      REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value);                     \
                    204:      fprintf((FILE), "\t.long\t0x%x\n", value);                                \
                    205:    } while (0)
                    206: 
                    207: /* This is how to output assembly code to define a `double' constant.
                    208:    We always have to use a pair of .long pseudo-ops to do this because
                    209:    the native SVR4 ELF assembler is buggy and it generates incorrect
                    210:    values when we try to use the the .double pseudo-op instead.  */
                    211: 
                    212: #undef ASM_OUTPUT_DOUBLE
                    213: #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                  \
                    214: do { long value[2];                                                    \
                    215:      REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value);                     \
                    216:      fprintf((FILE), "\t.long\t0x%x\n", value[0]);                     \
                    217:      fprintf((FILE), "\t.long\t0x%x\n", value[1]);                     \
                    218:    } while (0)
                    219: 
                    220: /* This is how to output an assembler line defining a `long double'
                    221:    constant.  */
                    222: 
                    223: #undef ASM_OUTPUT_LONG_DOUBLE
                    224: #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                             \
                    225: do { long value[4];                                                    \
                    226:      REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value);                        \
                    227:      fprintf((FILE), "\t.long\t0x%x\n", value[0]);                     \
                    228:      fprintf((FILE), "\t.long\t0x%x\n", value[1]);                     \
                    229:      fprintf((FILE), "\t.long\t0x%x\n", value[2]);                     \
                    230:      fprintf((FILE), "\t.long\t0x%x\n", value[3]);                     \
                    231:    } while (0)
1.1.1.3   root      232: 
                    233: /* Output assembler code to FILE to initialize this source file's
                    234:    basic block profiling info, if that has not already been done.  */
                    235: 
                    236: #undef FUNCTION_BLOCK_PROFILER
                    237: #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO)  \
                    238:   do { \
                    239:     if (TARGET_MEDANY) \
                    240:       fprintf (FILE, "\tsethi %%hi(.LLPBX0),%%o0\n\tor %%0,%%lo(.LLPBX0),%%o0\n\tld [%s+%%o0],%%o1\n\ttst %%o1\n\tbne .LLPY%d\n\tadd %%o0,%s,%%o0\n\tcall __bb_init_func\n\tnop\nLPY%d:\n", \
                    241:               MEDANY_BASE_REG, (LABELNO), MEDANY_BASE_REG, (LABELNO)); \
                    242:     else \
                    243:       fprintf (FILE, "\tsethi %%hi(.LLPBX0),%%o0\n\tld [%%lo(.LLPBX0)+%%o0],%%o1\n\ttst %%o1\n\tbne LPY%d\n\tadd %%o0,%%lo(.LLPBX0),%%o0\n\tcall __bb_init_func\n\tnop\nLPY%d:\n", \
                    244:               (LABELNO), (LABELNO)); \
                    245:   } while (0)
                    246: 
                    247: /* Output assembler code to FILE to increment the entry-count for
                    248:    the BLOCKNO'th basic block in this source file.  */
                    249: 
                    250: #undef BLOCK_PROFILER
                    251: #define BLOCK_PROFILER(FILE, BLOCKNO) \
                    252: { \
                    253:   int blockn = (BLOCKNO); \
                    254:   if (TARGET_MEDANY) \
                    255:     fprintf (FILE, "\tsethi %%hi(.LLPBX2+%d),%%g1\n\tor %%g1,%%lo(.LLPBX2+%d),%%g1\n\tld [%%g1+%s],%%g2\n\tadd %%g2,1,%%g2\n\tst %%g2,[%%g1+%s]\n", \
                    256:             4 * blockn, 4 * blockn, MEDANY_BASE_REG, MEDANY_BASE_REG); \
                    257:   else \
                    258:     fprintf (FILE, "\tsethi %%hi(.LLPBX2+%d),%%g1\n\tld [%%lo(.LLPBX2+%d)+%%g1],%%g2\n\
                    259: \tadd %%g2,1,%%g2\n\tst %%g2,[%%lo(.LLPBX2+%d)+%%g1]\n", \
                    260:             4 * blockn, 4 * blockn, 4 * blockn); \
                    261: }
                    262: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.