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

1.1       root        1: /* Target definitions for GNU compiler for Sparc running System V.4
                      2:    Copyright (C) 1991, 1992 Free Software Foundation, Inc.
                      3: 
                      4:    Written by Ron Guilmette ([email protected]).
                      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
                     20: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                     21: 
                     22: #include "sparc/sparc.h"
                     23: 
                     24: /* Undefine some symbols which are defined in "sparc.h" but which are
                     25:    appropriate only for SunOS 4.x, and not for svr4.  */
                     26: 
                     27: #undef DBX_DEBUGGING_INFO
                     28: #undef WORD_SWITCH_TAKES_ARG
                     29: #undef SELECT_SECTION
                     30: #undef ASM_DECLARE_FUNCTION_NAME
                     31: #undef TEXT_SECTION_ASM_OP
                     32: #undef DATA_SECTION_ASM_OP
                     33: 
                     34: #include "svr4.h"
                     35: 
                     36: /* Undefined some symbols which are defined in "svr4.h" but which are
                     37:    appropriate only for typical svr4 systems, but not for the specific
                     38:    case of svr4 running on a Sparc.  */
                     39: 
                     40: #undef CTORS_SECTION_ASM_OP
                     41: #undef DTORS_SECTION_ASM_OP
                     42: #undef INIT_SECTION_ASM_OP
                     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 \
                     55:   "-Dsparc -Dunix -D__svr4__ -Asystem(unix) -Acpu(sparc) -Amachine(sparc) \
                     56:    -D__GCC_NEW_VARARGS__"
                     57: 
                     58: /* The specialized code which needs to appear in the .init section prior
                     59:    to the prologue code for `__do_global_ctors' (see crtstuff.c).
                     60: 
                     61:    On Sparcs running svr4, the /usr/ccs/lib/crti.o file (with gets linked
                     62:    in prior to the crtbegin.o file) has a single `save' instruction in its
                     63:    .init section.  That `save' instruction tries to setup a stack frame for
                     64:    the sake of any subsequent code in the .init section.  Unfortunately,
                     65:    the size it uses for the stack frame is only a guess, and is not really
                     66:    adequate for our purposes.  More importantly, we independently put our
                     67:    own standard function prologue (for __do_global_ctors) into the .init
                     68:    section and that function prologue includes its own `save' instruction!
                     69:    Thus, unless we do something to correct the situation, we'll get *two*
                     70:    stack frames allocated when crt0.o calls the code in the .init section,
                     71:    and havoc will ensue.  The following macro definition prevents such woes.
                     72: */
                     73: 
                     74: #define INIT_SECTION_PREAMBLE  asm ("restore")
                     75: 
                     76: /* This is the string used to begin an assembly language comment for the
                     77:    Sparc/svr4 assembler.  */
                     78: 
                     79: #define ASM_COMMENT_START "!"
                     80: 
                     81: /* Define the names of various pseudo-op used by the Sparc/svr4 assembler.
                     82:    Note that many of these are different from the typical pseudo-ops used
                     83:    by most svr4 assemblers.  That is probably due to a (misguided?) attempt
                     84:    to keep the Sparc/svr4 assembler somewhat compatible with the Sparc/SunOS
                     85:    assembler.  */
                     86: 
                     87: #define STRING_ASM_OP          ".asciz"
                     88: #define COMMON_ASM_OP          ".common"
                     89: #define SKIP_ASM_OP            ".skip"
                     90: #define UNALIGNED_INT_ASM_OP   ".uaword"
                     91: #define UNALIGNED_SHORT_ASM_OP ".uahalf"
                     92: #define PUSHSECTION_ASM_OP     ".pushsection"
                     93: #define POPSECTION_ASM_OP      ".popsection"
                     94: 
                     95: /* This is the format used to print the second operand of a .type pseudo-op
                     96:    for the Sparc/svr4 assembler.  */
                     97: 
                     98: #define TYPE_OPERAND_FMT      "#%s"
                     99: 
                    100: /* This is the format used to print a .pushsection pseudo-op (and its operand)
                    101:    for the Sparc/svr4 assembler.  */
                    102: 
                    103: #define PUSHSECTION_FORMAT     "\t%s\t\"%s\"\n"
                    104: 
                    105: #undef ASM_OUTPUT_CASE_LABEL
                    106: #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE)            \
                    107: do { ASM_OUTPUT_ALIGN ((FILE), 2);                                     \
                    108:      ASM_OUTPUT_INTERNAL_LABEL ((FILE), PREFIX, NUM);                  \
                    109:    } while (0)
                    110: 
                    111: /* This is how to equate one symbol to another symbol.  The syntax used is
                    112:    `SYM1=SYM2'.  Note that this is different from the way equates are done
                    113:    with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'.  */
                    114: 
                    115: #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                             \
                    116:  do {  fprintf ((FILE), "\t");                                         \
                    117:        assemble_name (FILE, LABEL1);                                   \
                    118:        fprintf (FILE, " = ");                                          \
                    119:        assemble_name (FILE, LABEL2);                                   \
                    120:        fprintf (FILE, "\n");                                           \
                    121:   } while (0)
                    122: 
                    123: /* Define how the Sparc registers should be numbered for Dwarf output.
                    124:    The numbering provided here should be compatible with the native
                    125:    svr4 SDB debugger in the Sparc/svr4 reference port.  The numbering
                    126:    is as follows:
                    127: 
                    128:    Assembly name       gcc internal regno      Dwarf regno
                    129:    ----------------------------------------------------------
                    130:    g0-g7               0-7                     0-7
                    131:    o0-o7               8-15                    8-15
                    132:    l0-l7               16-23                   16-23
                    133:    i0-i7               24-31                   24-31
                    134:    f0-f31              32-63                   40-71
                    135: */
                    136: 
                    137: #define DBX_REGISTER_NUMBER(REGNO)                                     \
                    138:   (((REGNO) < 32) ? (REGNO)                                            \
                    139:    : ((REGNO) < 63) ? ((REGNO) + 8)                                    \
                    140:    : (abort (), 0))
                    141: 
                    142: /* A set of symbol definitions for assembly pseudo-ops which will
                    143:    get us switched to various sections of interest.  These are used
                    144:    in all places where we simply want to switch to a section, and
                    145:    *not* to push the previous section name onto the assembler's
                    146:    section names stack (as we do often in dwarfout.c).  */
                    147: 
                    148: #define TEXT_SECTION_ASM_OP    ".section\t\".text\""
                    149: #define DATA_SECTION_ASM_OP    ".section\t\".data\""
                    150: #define BSS_SECTION_ASM_OP     ".section\t\".bss\""
                    151: #define CONST_SECTION_ASM_OP   ".section\t\".rodata\""
                    152: #define INIT_SECTION_ASM_OP    ".section\t\".init\",#alloc"
                    153: #define CTORS_SECTION_ASM_OP    ".section\t\".ctors\",#alloc"
                    154: #define DTORS_SECTION_ASM_OP    ".section\t\".dtors\",#alloc"
                    155: 
                    156: /* If the host and target formats match, output the floats as hex.  */
                    157: #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
                    158: #if defined (HOST_WORDS_BIG_ENDIAN) == WORDS_BIG_ENDIAN
                    159: 
                    160: /* This is how to output assembly code to define a `float' constant.
                    161:    We always have to use a .long pseudo-op to do this because the native
                    162:    SVR4 ELF assembler is buggy and it generates incorrect values when we
                    163:    try to use the .float pseudo-op instead.  */
                    164: 
                    165: #undef ASM_OUTPUT_FLOAT
                    166: #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                   \
                    167: do { long value;                                                       \
                    168:      REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value);                     \
                    169:      fprintf((FILE), "\t.long\t0x%x\n", value);                                \
                    170:    } while (0)
                    171: 
                    172: /* This is how to output assembly code to define a `double' constant.
                    173:    We always have to use a pair of .long pseudo-ops to do this because
                    174:    the native SVR4 ELF assembler is buggy and it generates incorrect
                    175:    values when we try to use the the .double pseudo-op instead.  */
                    176: 
                    177: #undef ASM_OUTPUT_DOUBLE
                    178: #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                  \
                    179: do { long value[2];                                                    \
                    180:      REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value);                     \
                    181:      fprintf((FILE), "\t.long\t0x%x\n", value[0]);                     \
                    182:      fprintf((FILE), "\t.long\t0x%x\n", value[1]);                     \
                    183:    } while (0)
                    184: 
                    185: #endif /* word order matches */
                    186: #endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
                    187: 
                    188: /* This is how to output an assembler line defining a `long double'
                    189:    constant.  */
                    190: 
                    191: #undef ASM_OUTPUT_LONG_DOUBLE
                    192: #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                             \
                    193: do { long value[4];                                                    \
                    194:      REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value);                        \
                    195:      fprintf((FILE), "\t.long\t0x%x\n", value[0]);                     \
                    196:      fprintf((FILE), "\t.long\t0x%x\n", value[1]);                     \
                    197:      fprintf((FILE), "\t.long\t0x%x\n", value[2]);                     \
                    198:      fprintf((FILE), "\t.long\t0x%x\n", value[3]);                     \
                    199:    } while (0)

unix.superglobalmegacorp.com

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