Annotation of gcc/config/next.h, revision 1.1.1.2

1.1       root        1: /* next.h:  definitions for NeXT.
                      2: 
                      3: This file is part of GNU CC.
                      4: 
                      5: GNU CC is free software; you can redistribute it and/or modify
                      6: it under the terms of the GNU General Public License as published by
                      7: the Free Software Foundation; either version 2, or (at your option)
                      8: any later version.
                      9: 
                     10: GNU CC is distributed in the hope that it will be useful,
                     11: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     12: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     13: GNU General Public License for more details.
                     14: 
                     15: You should have received a copy of the GNU General Public License
                     16: along with GNU CC; see the file COPYING.  If not, write to
                     17: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                     18: 
                     19: #include "m68k.h"
                     20: 
                     21: #define EXTRA_FORMAT_FUNCTIONS \
                     22:       "NXPrintf",      FALSE,  2,      FALSE,  \
                     23:       "NXScanf",       TRUE,   2,      FALSE,  \
                     24:       "NXVPrintf",     FALSE,  2,      TRUE,   \
                     25:       "NXVScanf",      TRUE,   2,      TRUE,   \
                     26:       "DPSPrintf",     FALSE,  2,      FALSE,  \
                     27:       "bsd_sprintf",   FALSE,  2,      FALSE,  \
                     28:       "bsd_vsprintf",  FALSE,  2,      TRUE,
                     29: 
                     30: /* Use NeXT's special calling convention for sending an Objc message.  */
                     31: #define NEXT_OBJC_RUNTIME
                     32: 
                     33: /* We have atexit.  */
                     34: #define HAVE_ATEXIT
                     35: 
                     36: /* Enable recent gcc to compile under the old gcc in Next release 1.0.  */
                     37: #define __inline inline
                     38: 
                     39: /* See m68k.h.  0407 means 68040 (or 68030 or 68020, with 68881/2).  */
                     40: 
                     41: #define TARGET_DEFAULT 0407
                     42: 
                     43: /* wchar_t is unsigned short */
                     44: 
                     45: #undef WCHAR_TYPE
                     46: #undef WCHAR_TYPE_SIZE
                     47: #define WCHAR_TYPE "short unsigned int"
                     48: #define WCHAR_TYPE_SIZE (BITS_PER_WORD / 2)
                     49: 
                     50: /* Give methods pretty symbol names on NeXT. */
                     51: 
                     52: #define OBJC_GEN_METHOD_LABEL(BUF,IS_INST,CLASS_NAME,CAT_NAME,SEL_NAME)        \
                     53:   do { if (CAT_NAME)                                                   \
                     54:         sprintf (BUF, "%c[%s(%s) %s]", (IS_INST) ? '-' : '+',          \
                     55:                  (CLASS_NAME), (CAT_NAME), (SEL_NAME));                \
                     56:        else                                                            \
                     57:         sprintf (BUF, "%c[%s %s]", (IS_INST) ? '-' : '+',              \
                     58:                  (CLASS_NAME), (SEL_NAME));                            \
                     59:      } while (0)
                     60: 
                     61: /* Wrap new method names in quotes so the assembler doesn't gag.
1.1.1.2 ! root       62:    Make Objective-C internal symbols local.  */
1.1       root       63: 
                     64: #undef ASM_OUTPUT_LABELREF
                     65: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
                     66:   do { if (NAME[0] == '+' || NAME[0] == '-') fprintf (FILE, "\"%s\"", NAME); \
                     67:        else if (!strncmp (NAME, "_OBJC_", 6)) fprintf (FILE, "L%s", NAME);   \
1.1.1.2 ! root       68:        else if (!strncmp (NAME, ".objc_class_name_", 17))              \
        !            69:         fprintf (FILE, "%s", NAME);                                    \
1.1       root       70:        else fprintf (FILE, "_%s", NAME); } while (0)
                     71: 
                     72: #undef STACK_BOUNDARY
                     73: /* Boundary (in *bits*) on which stack pointer should be aligned.  */
                     74: #define STACK_BOUNDARY 32
                     75: 
                     76: /* These compiler options take n arguments.  */
                     77: 
                     78: #define WORD_SWITCH_TAKES_ARG(STR)             \
                     79:   (!strcmp (STR, "Ttext") ? 1 :                        \
                     80:    !strcmp (STR, "Tdata") ? 1 :                        \
                     81:    !strcmp (STR, "include") ? 1 :              \
                     82:    !strcmp (STR, "imacros") ? 1 :              \
                     83:    !strcmp (STR, "segalign") ? 1 :             \
                     84:    !strcmp (STR, "seg1addr") ? 1 :             \
                     85:    !strcmp (STR, "segaddr") ? 2 :              \
                     86:    !strcmp (STR, "sectobjectsymbols") ? 2 :    \
                     87:    !strcmp (STR, "segprot") ? 3 :              \
                     88:    !strcmp (STR, "sectcreate") ? 3 :           \
                     89:    !strcmp (STR, "sectalign") ? 3 :            \
                     90:    !strcmp (STR, "segcreate") ? 3 :            \
                     91:    !strcmp (STR, "sectorder") ? 3 :            \
1.1.1.2 ! root       92:    !strcmp (STR, "aux-info") ? 1 :             \
1.1       root       93:    0)
                     94: 
                     95: /* Names to predefine in the preprocessor for this target machine.  */
                     96: 
                     97: #define CPP_PREDEFINES "-Dmc68000 -Dm68k -DNeXT -Dunix -D__MACH__"
                     98: 
                     99: /* Machine dependent ccp options.  */
                    100: 
                    101: /* This option used to be called -bsd, but that conflicts with the
                    102:    general -b option.  */
                    103: #define CPP_SPEC "%{strict-bsd:-D__STRICT_BSD__}"
                    104: 
                    105: /* Machine dependent ld options.  */
                    106: 
                    107: #define LINK_SPEC "%{Z} %{M} \
                    108: %{execute*} %{object*} %{preload*} %{fvmlib*} \
                    109: %{segalign*} %{seg1addr*} %{segaddr*} %{segprot*} \
                    110: %{seglinkedit*} %{noseglinkedit*} \
                    111: %{sectcreate*} %{sectalign*} %{sectobjectsymbols}\
                    112: %{segcreate*} %{Mach*} %{whyload} %{w} \
                    113: %{sectorder*} %{whatsloaded}"
                    114: 
                    115: /* Machine dependent libraries.  */
                    116: 
                    117: #define LIB_SPEC "%{!p:%{!pg:-lsys_s}} %{pg:-lsys_p}"
                    118:  
                    119: /* We specify crt0.o as -lcrt0.o so that ld will search the library path. */
                    120: #define STARTFILE_SPEC  \
                    121:   "%{pg:-lgcrt0.o}%{!pg: \
                    122:      %{p:%e-p profiling is no longer supported.  Use -pg instead.} \
                    123:      %{!p:-lcrt0.o}}"
                    124: 
                    125: /* Every structure or union's size must be a multiple of 2 bytes.
                    126:    (Why isn't this in m68k.h?)  */
                    127: 
                    128: #define STRUCTURE_SIZE_BOUNDARY 16
                    129: 
                    130: /* Why not? */
                    131: 
                    132: #define DOLLARS_IN_IDENTIFIERS 2
                    133: 
                    134: /* Allow #sscs (but don't do anything). */
                    135: 
                    136: #define SCCS_DIRECTIVE
                    137: 
                    138: /* We use Dbx symbol format.  */
                    139: 
                    140: #define DBX_DEBUGGING_INFO
                    141: 
                    142: /* This saves a fair amount of space. */
                    143: 
                    144: #define DBX_CONTIN_LENGTH 0
                    145: 
                    146: /* These screw up NeXT's gdb at the moment, so don't use them. */
                    147: 
                    148: #define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(FILE, FILENAME)
                    149: 
                    150: /* gdb needs a null N_SO at the end of each file for scattered loading. */
                    151: 
                    152: #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME)                        \
                    153:   fprintf (FILE,                                                       \
                    154:           "\t.text\n\t.stabs \"%s\",%d,0,0,Letext\nLetext:\n",         \
                    155:           "" , N_SO)
                    156: 
                    157: /* Don't use .gcc_compiled symbols to communicate with GDB;
                    158:    They interfere with numerically sorted symbol lists. */
                    159: 
                    160: #define ASM_IDENTIFY_GCC(asm_out_file)
                    161: 
                    162: /* This is how to output an assembler line defining a `double' constant.  */
                    163: 
                    164: #undef ASM_OUTPUT_DOUBLE
                    165: #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                  \
                    166:   (REAL_VALUE_ISINF ((VALUE))                                          \
                    167:    ? fprintf (FILE, "\t.double 0r%s99e999\n", ((VALUE) > 0 ? "" : "-")) \
                    168:    : fprintf (FILE, "\t.double 0r%.20e\n", (VALUE)))
                    169: 
                    170: /* This is how to output an assembler line defining a `float' constant.  */
                    171: 
                    172: #undef ASM_OUTPUT_FLOAT
                    173: #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                   \
                    174:   (REAL_VALUE_ISINF ((VALUE))                                          \
                    175:    ? fprintf (FILE, "\t.single 0r%s99e999\n", ((VALUE) > 0 ? "" : "-")) \
                    176:    : fprintf (FILE, "\t.single 0r%.20e\n", (VALUE)))
                    177: 
                    178: #undef ASM_OUTPUT_FLOAT_OPERAND
                    179: #define ASM_OUTPUT_FLOAT_OPERAND(FILE,VALUE)                           \
                    180:   (REAL_VALUE_ISINF ((VALUE))                                          \
                    181:    ? fprintf (FILE, "#0r%s99e999", ((VALUE) > 0 ? "" : "-")) \
                    182:    : fprintf (FILE, "#0r%.9g", (VALUE)))
                    183: 
                    184: #undef ASM_OUTPUT_DOUBLE_OPERAND
                    185: #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                          \
                    186:   (REAL_VALUE_ISINF ((VALUE))                                          \
                    187:    ? fprintf (FILE, "#0r%s99e999", ((VALUE) > 0 ? "" : "-")) \
                    188:    : fprintf (FILE, "#0r%.20g", (VALUE)))
                    189: 
1.1.1.2 ! root      190: #if 0 /* This is for system verson 3.0, which isn't out yet.  */
1.1       root      191: #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)      \
                    192:   do { constructor_section ();                 \
                    193:        ASM_OUTPUT_ALIGN (FILE, 1);             \
                    194:        fprintf (FILE, "\t.long ");             \
                    195:        assemble_name (FILE, NAME);             \
                    196:        fprintf (FILE, "\n"); } while (0)
                    197: 
                    198: #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)       \
                    199:   do { destructor_section ();                  \
                    200:        ASM_OUTPUT_ALIGN (FILE, 1);             \
                    201:        fprintf (FILE, "\t.long ");             \
                    202:        assemble_name (FILE, NAME);             \
                    203:        fprintf (FILE, "\n"); } while (0)
1.1.1.2 ! root      204: #endif
1.1       root      205: 
                    206: /* How to parse #pragma's */
                    207: 
                    208: #define HANDLE_PRAGMA(finput) handle_pragma (finput)
                    209: 
                    210: /* Create new Mach-O sections. */
                    211: 
                    212: #define SECTION_FUNCTION(FUNCTION, SECTION, DIRECTIVE, WAS_TEXT)       \
                    213: void                                                                   \
                    214: FUNCTION ()                                                            \
                    215: {                                                                      \
                    216:   extern void text_section ();                                         \
                    217:   extern int flag_no_mach_text_sections;                               \
                    218:                                                                        \
                    219:   if (WAS_TEXT && flag_no_mach_text_sections)                          \
                    220:     text_section ();                                                   \
                    221:   else if (in_section != SECTION)                                      \
                    222:     {                                                                  \
                    223:       fprintf (asm_out_file, "%s\n", DIRECTIVE);                       \
                    224:       in_section = SECTION;                                            \
                    225:     }                                                                  \
                    226: }                                                                      \
                    227: 
                    228: #define EXTRA_SECTIONS                                 \
                    229:   in_const, in_cstring, in_literal4, in_literal8,      \
                    230:   in_constructor, in_destructor,                       \
                    231:   in_objc_class, in_objc_meta_class, in_objc_category, \
                    232:   in_objc_class_vars, in_objc_instance_vars,           \
                    233:   in_objc_cls_meth, in_objc_inst_meth,                 \
                    234:   in_objc_cat_cls_meth, in_objc_cat_inst_meth,         \
                    235:   in_objc_selector_strs, in_objc_selector_refs,                \
                    236:   in_objc_symbols, in_objc_module_info
                    237: 
                    238: #define EXTRA_SECTION_FUNCTIONS                        \
                    239: SECTION_FUNCTION (const_section,               \
                    240:                  in_const,                     \
                    241:                  ".const", 1)                  \
                    242: SECTION_FUNCTION (cstring_section,             \
                    243:                  in_cstring,                   \
                    244:                  ".cstring", 1)                \
                    245: SECTION_FUNCTION (literal4_section,            \
                    246:                  in_literal4,                  \
                    247:                  ".literal4", 1)               \
                    248: SECTION_FUNCTION (literal8_section,            \
                    249:                  in_literal8,                  \
                    250:                  ".literal8", 1)               \
                    251: SECTION_FUNCTION (constructor_section,         \
                    252:                  in_constructor,               \
                    253:                  ".constructor", 0)            \
                    254: SECTION_FUNCTION (destructor_section,          \
                    255:                  in_destructor,                \
                    256:                  ".destructor", 0)             \
                    257: SECTION_FUNCTION (objc_class_section,          \
                    258:                  in_objc_class,                \
                    259:                  ".objc_class", 0)             \
                    260: SECTION_FUNCTION (objc_meta_class_section,     \
                    261:                  in_objc_meta_class,           \
                    262:                  ".objc_meta_class", 0)        \
                    263: SECTION_FUNCTION (objc_category_section,       \
                    264:                  in_objc_category,             \
                    265:                ".objc_category", 0)            \
                    266: SECTION_FUNCTION (objc_class_vars_section,     \
                    267:                  in_objc_class_vars,           \
                    268:                  ".objc_class_vars", 0)        \
                    269: SECTION_FUNCTION (objc_instance_vars_section,  \
                    270:                  in_objc_instance_vars,        \
                    271:                  ".objc_instance_vars", 0)     \
                    272: SECTION_FUNCTION (objc_cls_meth_section,       \
                    273:                  in_objc_cls_meth,             \
                    274:                  ".objc_cls_meth", 0)          \
                    275: SECTION_FUNCTION (objc_inst_meth_section,      \
                    276:                  in_objc_inst_meth,            \
                    277:                  ".objc_inst_meth", 0)         \
                    278: SECTION_FUNCTION (objc_cat_cls_meth_section,   \
                    279:                  in_objc_cat_cls_meth,         \
                    280:                  ".objc_cat_cls_meth", 0)      \
                    281: SECTION_FUNCTION (objc_cat_inst_meth_section,  \
                    282:                  in_objc_cat_inst_meth,        \
                    283:                  ".objc_cat_inst_meth", 0)     \
                    284: SECTION_FUNCTION (objc_selector_strs_section,  \
                    285:                  in_objc_selector_strs,        \
                    286:                  ".objc_selector_strs", 0)     \
                    287: SECTION_FUNCTION (objc_selector_refs_section,  \
                    288:                  in_objc_selector_refs,        \
                    289:                  ".objc_selector_refs", 0)     \
                    290: SECTION_FUNCTION (objc_symbols_section,                \
                    291:                  in_objc_symbols,              \
                    292:                  ".objc_symbols", 0)           \
                    293: SECTION_FUNCTION (objc_module_info_section,    \
                    294:                  in_objc_module_info,          \
                    295:                  ".objc_module_info", 0)
                    296: 
                    297: #define READONLY_DATA_SECTION const_section
                    298: 
                    299: #define SELECT_SECTION(exp,reloc)                              \
                    300:   do                                                           \
                    301:     {                                                          \
                    302:       if (TREE_CODE (exp) == STRING_CST)                       \
                    303:        {                                                       \
                    304:          if (flag_writable_strings)                            \
                    305:            data_section ();                                    \
                    306:          else if (TREE_STRING_LENGTH (exp) !=                  \
                    307:                   strlen (TREE_STRING_POINTER (exp)) + 1)      \
                    308:            readonly_data_section ();                           \
                    309:          else                                                  \
                    310:            cstring_section ();                                 \
                    311:        }                                                       \
                    312:       else if (TREE_CODE (exp) == INTEGER_CST                  \
                    313:               || TREE_CODE (exp) == REAL_CST)                  \
                    314:         {                                                      \
                    315:          tree size = TYPE_SIZE (TREE_TYPE (exp));              \
                    316:                                                                \
                    317:          if (TREE_CODE (size) == INTEGER_CST &&                \
                    318:              TREE_INT_CST_LOW (size) == 4 &&                   \
                    319:              TREE_INT_CST_HIGH (size) == 0)                    \
                    320:            literal4_section ();                                \
                    321:          else if (TREE_CODE (size) == INTEGER_CST &&           \
                    322:              TREE_INT_CST_LOW (size) == 8 &&                   \
                    323:              TREE_INT_CST_HIGH (size) == 0)                    \
                    324:            literal8_section ();                                \
                    325:          else                                                  \
                    326:            readonly_data_section ();                           \
                    327:        }                                                       \
                    328:       else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp))    \
                    329:               && !TREE_SIDE_EFFECTS (exp))                             \
                    330:        readonly_data_section ();                                       \
                    331:       else if (TREE_CODE (exp) == VAR_DECL &&                          \
                    332:               DECL_NAME (exp) &&                                       \
                    333:               TREE_CODE (DECL_NAME (exp)) == IDENTIFIER_NODE &&        \
                    334:               IDENTIFIER_POINTER (DECL_NAME (exp)) &&                  \
                    335:               !strncmp (IDENTIFIER_POINTER (DECL_NAME (exp)), "_OBJC_", 6)) \
                    336:        {                                                               \
                    337:          const char *name = IDENTIFIER_POINTER (DECL_NAME (exp));      \
                    338:                                                                        \
                    339:          if (!strncmp (name, "_OBJC_CLASS_METHODS_", 20))              \
                    340:            objc_cls_meth_section ();                                   \
                    341:          else if (!strncmp (name, "_OBJC_INSTANCE_METHODS_", 23))      \
                    342:            objc_inst_meth_section ();                                  \
                    343:          else if (!strncmp (name, "_OBJC_CATEGORY_CLASS_METHODS_", 20)) \
                    344:            objc_cat_cls_meth_section ();                               \
                    345:          else if (!strncmp (name, "_OBJC_CATEGORY_INSTANCE_METHODS_", 23)) \
                    346:            objc_cat_inst_meth_section ();                              \
                    347:          else if (!strncmp (name, "_OBJC_CLASS_VARIABLES_", 22))       \
                    348:            objc_class_vars_section ();                                 \
                    349:          else if (!strncmp (name, "_OBJC_INSTANCE_VARIABLES_", 25))    \
                    350:            objc_instance_vars_section ();                              \
                    351:          else if (!strncmp (name, "_OBJC_CLASS_", 12))                 \
                    352:            objc_class_section ();                                      \
                    353:          else if (!strncmp (name, "_OBJC_METACLASS_", 16))             \
                    354:            objc_meta_class_section ();                                 \
                    355:          else if (!strncmp (name, "_OBJC_CATEGORY_", 15))              \
                    356:            objc_category_section ();                                   \
                    357:          else if (!strncmp (name, "_OBJC_STRINGS", 13))                \
                    358:            objc_selector_strs_section ();                              \
                    359:          else if (!strncmp (name, "_OBJC_SELECTOR_REFERENCES", 25))    \
                    360:            objc_selector_refs_section ();                              \
                    361:          else if (!strncmp (name, "_OBJC_SYMBOLS", 13))                \
                    362:            objc_symbols_section ();                                    \
                    363:          else if (!strncmp (name, "_OBJC_MODULES", 13))                \
                    364:            objc_module_info_section ();                                \
                    365:          else                                                          \
                    366:            data_section ();                                            \
                    367:        }                                                               \
                    368:       else                                                             \
                    369:         data_section ();                                               \
                    370:     }                                                                  \
                    371:   while (0)
                    372: 
                    373: /* Force the assembler to create all the Objective-C sections,
                    374:     so that their order is guaranteed. */
                    375:   
                    376: #define OBJC_PROLOGUE                                  \
                    377:   do {                                                 \
                    378:        extern void objc_class_section ();              \
                    379:        extern void objc_meta_class_section ();         \
                    380:        extern void objc_cat_cls_meth_section ();       \
                    381:        extern void objc_cat_inst_meth_section ();      \
                    382:        extern void objc_cls_meth_section ();           \
                    383:        extern void objc_inst_meth_section ();          \
                    384:        extern void objc_selector_refs_section ();      \
                    385:        extern void objc_symbols_section ();            \
                    386:        extern void objc_category_section ();           \
                    387:        extern void objc_class_vars_section ();         \
                    388:        extern void objc_instance_vars_section ();      \
                    389:        extern void objc_module_info_section ();        \
                    390:        extern void objc_selector_strs_section ();      \
                    391:                                                        \
                    392:        objc_class_section ();          \
                    393:        objc_meta_class_section ();     \
                    394:        objc_cat_cls_meth_section ();   \
                    395:        objc_cat_inst_meth_section ();  \
                    396:        objc_cls_meth_section ();       \
                    397:        objc_inst_meth_section ();      \
                    398:        objc_selector_refs_section ();  \
                    399:        objc_symbols_section ();        \
                    400:        objc_category_section ();       \
                    401:        objc_class_vars_section ();     \
                    402:        objc_instance_vars_section ();  \
                    403:        objc_module_info_section ();    \
                    404:        objc_selector_strs_section ();  \
                    405:      } while (0)
                    406: 
                    407: /* We do not define JUMP_TABLES_IN_TEXT_SECTION, since we wish to keep
                    408:    the text section pure.  There is no point in addressing the jump
                    409:    tables using pc relative addressing, since they are not in the text
                    410:    section, so we undefine CASE_VECTOR_PC_RELATIVE.  This also
                    411:    causes the compiler to use absolute addresses in the jump table,
                    412:    so we redefine CASE_VECTOR_MODE to be SImode. */
                    413: 
                    414: #undef CASE_VECTOR_MODE
                    415: #define CASE_VECTOR_MODE SImode
                    416: 
                    417: #undef CASE_VECTOR_PC_RELATIVE
                    418: 
                    419: /* Don't treat addresses involving labels differently from symbol names.
1.1.1.2 ! root      420:    Previously, references to labels generated pc-relative addressing modes
1.1       root      421:    while references to symbol names generated absolute addressing modes.  */
                    422: 
                    423: #undef GO_IF_INDEXABLE_BASE(X, ADDR)
                    424: #define GO_IF_INDEXABLE_BASE(X, ADDR)  \
                    425: { if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR; }
                    426: 
1.1.1.2 ! root      427: #define ALIGN_ASM_OP           ".align"
1.1       root      428: 
                    429: #undef ASM_OUTPUT_ALIGN
                    430: #define ASM_OUTPUT_ALIGN(FILE,LOG)     \
                    431:   if ((LOG) != 0)                      \
1.1.1.2 ! root      432:     fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG))
1.1       root      433: 
                    434: /* The maximum alignment which the object file format can support.
                    435:    For NeXT's Mach-O format, this is 2^15.  */
                    436: 
                    437: #define MAX_OFILE_ALIGNMENT 0x8000

unix.superglobalmegacorp.com

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