Annotation of GNUtools/cc/config/sparc/pbd.h, revision 1.1.1.1

1.1       root        1: /* Definitions of target machine for GNU compiler.
                      2: 
                      3:    Citicorp/TTI Unicom PBD version
                      4:    (using GAS and  COFF (encapsulated is unacceptable) )
                      5: 
                      6:    Copyright (C) 1990 Free Software Foundation, Inc.
                      7: 
                      8: This file is part of GNU CC.
                      9: 
                     10: GNU CC is free software; you can redistribute it and/or modify
                     11: it under the terms of the GNU General Public License as published by
                     12: the Free Software Foundation; either version 2, or (at your option)
                     13: any later version.
                     14: 
                     15: GNU CC is distributed in the hope that it will be useful,
                     16: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: GNU General Public License for more details.
                     19: 
                     20: You should have received a copy of the GNU General Public License
                     21: along with GNU CC; see the file COPYING.  If not, write to
                     22: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                     23: 
                     24: #include "sparc/sparc.h"
                     25: 
                     26: /* Names to predefine in the preprocessor for this target machine.  */
                     27: 
                     28: #undef CPP_PREDEFINES
                     29: #define CPP_PREDEFINES "-Dsparc -DUnicomPBD -Dunix -D__GCC_NEW_VARARGS__ -Asystem(unix) -Acpu(sparc) -Amachine(sparc)"
                     30: 
                     31: /* We want DBX format for use with gdb under COFF.  */
                     32: 
                     33: #define DBX_DEBUGGING_INFO
                     34: 
                     35: /* Generate calls to memcpy, memcmp and memset.  */
                     36: 
                     37: #define TARGET_MEM_FUNCTIONS
                     38: 
                     39: /* we use /lib/libp/lib*  when profiling */
                     40: 
                     41: #undef LIB_SPEC
                     42: #define LIB_SPEC "%{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp} -lc"
                     43: 
                     44: 
                     45: /* Use crt1.o as a startup file and crtn.o as a closing file.  */
                     46: /*
                     47:  * The loader directive file gcc.ifile defines how to merge the constructor 
                     48:  * sections into the data section.  Also, since gas only puts out those 
                     49:  * sections in response to N_SETT stabs, and does not (yet) have a 
                     50:  * ".sections" directive, gcc.ifile also defines the list symbols 
                     51:  * __DTOR_LIST__ and __CTOR_LIST__.
                     52:  * 
                     53:  * Finally, we must explicitly specify the file from libgcc.a that defines
                     54:  * exit(), otherwise if the user specifies (for example) "-lc_s" on the 
                     55:  * command line, the wrong exit() will be used and global destructors will 
                     56:  * not get called .
                     57:  */
                     58: 
                     59: #define STARTFILE_SPEC \
                     60: "%{!r: gcc.ifile%s} %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} \
                     61: %{!r:_exit.o%s}"
                     62: 
                     63: #define ENDFILE_SPEC "crtn.o%s"
                     64: 
                     65: /* cpp has to support a #sccs directive for the /usr/include files */
                     66: 
                     67: #define SCCS_DIRECTIVE
                     68: 
                     69: /* LINK_SPEC is needed only for SunOS 4.  */
                     70: 
                     71: #undef LINK_SPEC
                     72: 
                     73: /* Although the gas we use can create .ctor and .dtor sections from N_SETT
                     74:    stabs, it does not support section directives, so we need to have the loader
                     75:    define the lists.
                     76:    */
                     77: #define CTOR_LISTS_DEFINED_EXTERNALLY
                     78: 
                     79: /* similar to default, but allows for the table defined by ld with gcc.ifile. 
                     80:    nptrs is always 0.  So we need to instead check that __DTOR_LIST__[1] != 0.
                     81:    The old check is left in so that the same macro can be used if and when  
                     82:    a future version of gas does support section directives. */
                     83: 
                     84: #define DO_GLOBAL_DTORS_BODY {int nptrs = *(int *)__DTOR_LIST__; int i; \
                     85:   if (nptrs == -1 || (__DTOR_LIST__[0] == 0 && __DTOR_LIST__[1] != 0))  \
                     86:     for (nptrs = 0; __DTOR_LIST__[nptrs + 1] != 0; nptrs++);           \
                     87:   for (i = nptrs; i >= 1; i--)                                         \
                     88:     __DTOR_LIST__[i] (); }
                     89: 
                     90: /* 
                     91:  * Here is an example gcc.ifile.  I've tested it on PBD sparc
                     92:  * systems. The NEXT(0x200000) works on just about all 386 and m68k systems, 
                     93:  * but can be reduced to any power of 2 that is >= NBPS (0x40000 on a pbd).
                     94: 
                     95:    SECTIONS {
                     96:        .text BIND(0x41000200) BLOCK (0x200) : 
                     97:                { *(.init) *(.text) vfork = fork; *(.fini) }
                     98: 
                     99:        GROUP BIND( NEXT(0x200000) + ADDR(.text) + SIZEOF(.text)):
                    100:        {      .data : { __CTOR_LIST__ = . ; . += 4; *(.ctor) . += 4 ;
                    101:                         __DTOR_LIST__ = . ; . += 4; *(.dtor) . += 4 ; }
                    102:               .bss : { }
                    103:        }
                    104:   }
                    105:  */
                    106: 
                    107: #undef  ASM_OUTPUT_LABELREF
                    108: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
                    109:   fprintf (FILE, "%s", NAME)
                    110: 
                    111: /* fixes: */
                    112: /*
                    113:  *  Internal labels are prefixed with a period.
                    114:  */
                    115: 
                    116: /* This is how to store into the string LABEL
                    117:    the symbol_ref name of an internal numbered label where
                    118:    PREFIX is the class of label and NUM is the number within the class.
                    119:    This is suitable for output with `assemble_name'.  */
                    120: 
                    121: #undef ASM_GENERATE_INTERNAL_LABEL
                    122: 
                    123: #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)                   \
                    124:         sprintf (LABEL, "*.%s%d", PREFIX, NUM)
                    125: 
                    126: 
                    127: /* This is how to output an internal numbered label where
                    128:    PREFIX is the class of label and NUM is the number within the class.  */
                    129: 
                    130: #undef  ASM_OUTPUT_INTERNAL_LABEL
                    131: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)                      \
                    132:         fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
                    133: 
                    134: /* This is how to output an element of a case-vector that is relative.  */
                    135: 
                    136: #undef  ASM_OUTPUT_ADDR_DIFF_ELT
                    137: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL)  \
                    138:   fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
                    139: 
                    140: /* This is how to output an element of a case-vector that is absolute.
                    141:    (The 68000 does not use such vectors,
                    142:    but we must define this macro anyway.)  */
                    143: 
                    144: #undef ASM_OUTPUT_ADDR_VEC_ELT
                    145: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
                    146:   fprintf (FILE, "\t.word .L%d\n", VALUE)
                    147: 
                    148: /* Output assembler code to FILE to increment profiler label # LABELNO
                    149:    for profiling a function entry.  */
                    150: 
                    151: #undef FUNCTION_PROFILER
                    152: #define FUNCTION_PROFILER(FILE, LABELNO)  \
                    153:   fprintf (FILE, "\tsethi %%hi(.LP%d),%%o0\n\tcall mcount\n\tor %%lo(.LP%d),%%o0,%%o0\n", \
                    154:           (LABELNO), (LABELNO))
                    155: 
                    156: /* Output assembler code to FILE to initialize this source file's
                    157:    basic block profiling info, if that has not already been done.  */
                    158: 
                    159: #undef FUNCTION_BLOCK_PROFILER
                    160: #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO)  \
                    161:   fprintf (FILE, "\tsethi %%hi(.LPBX0),%%o0\n\tld [%%lo(.LPBX0)+%%o0],%%o1\n\ttst %%o1\n\tbne .LPY%d\n\tnop\n\tcall ___bb_init_func\n\tnop\n.LPY%d:\n",  \
                    162:           (LABELNO), (LABELNO))
                    163: 
                    164: /* Output assembler code to FILE to increment the entry-count for
                    165:    the BLOCKNO'th basic block in this source file.  */
                    166: 
                    167: #undef BLOCK_PROFILER
                    168: #define BLOCK_PROFILER(FILE, BLOCKNO) \
                    169: {                                                              \
                    170:   int blockn = (BLOCKNO);                                      \
                    171:   fprintf (FILE, "\tsethi %%hi(.LPBX2+%d),%%g1\n\tld [%%lo(.LPBX2+%d)+%%g1],%%g2\n\
                    172: \tadd %%g2,1,%%g2\n\tst %%g2,[%%lo(.LPBX2+%d)+%%g1]\n",                \
                    173:           4 * blockn, 4 * blockn, 4 * blockn);                 \
                    174:   CC_STATUS_INIT;  /* We have clobbered %g1.  Also %g2.  */    \
                    175: }
                    176: /*   This is needed for SunOS 4.0, and should not hurt for 3.2
                    177:    versions either.  */
                    178: #undef ASM_OUTPUT_SOURCE_LINE(file, line) 
                    179: #define ASM_OUTPUT_SOURCE_LINE(file, line)             \
                    180:   { static int sym_lineno = 1;                         \
                    181:     fprintf (file, ".stabn 68,0,%d,.LM%d\n.LM%d:\n",   \
                    182:             line, sym_lineno, sym_lineno);             \
                    183:     sym_lineno += 1; }
                    184: 
                    185: #define ASM_INT_OP ".long "

unix.superglobalmegacorp.com

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