|
|
1.1 ! root 1: /* Core target definitions for GNU compiler ! 2: for IBM RS/6000 PowerPC running NetWare ! 3: Copyright (C) 1994 Free Software Foundation, Inc. ! 4: Contributed by Cygnus Support. ! 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 "rs6000/powerpc.h" ! 23: ! 24: /* Don't generate XCOFF debugging information. */ ! 25: ! 26: #undef XCOFF_DEBUGGING_INFO ! 27: ! 28: /* Don't use the COFF object file format. */ ! 29: ! 30: #undef OBJECT_FORMAT_COFF ! 31: ! 32: /* The XCOFF support uses weird symbol suffixes, which we don't want ! 33: for ELF. */ ! 34: ! 35: #undef RS6000_OUTPUT_BASENAME ! 36: #define RS6000_OUTPUT_BASENAME(FILE, NAME) assemble_name (FILE, NAME) ! 37: ! 38: /* Don't bother to output .extern pseudo-ops. They are not needed by ! 39: ELF assemblers. */ ! 40: ! 41: #undef ASM_OUTPUT_EXTERNAL ! 42: ! 43: /* Undefine some things which are defined by the generic svr4.h. */ ! 44: ! 45: #undef ASM_FILE_END ! 46: #undef ASM_OUTPUT_EXTERNAL_LIBCALL ! 47: #undef READONLY_DATA_SECTION ! 48: #undef SELECT_SECTION ! 49: #undef ASM_DECLARE_FUNCTION_NAME ! 50: ! 51: /* Use the regular svr4 definitions. */ ! 52: ! 53: #include "svr4.h" ! 54: #include "netware.h" ! 55: ! 56: /* Create a function descriptor when we declare a function name. This ! 57: is a mixture of the ASM_DECLARE_FUNCTION_NAME macros in rs6000.h ! 58: and svr4.h. The unmodified function name is used to name the ! 59: descriptor. The function name with an initial `.' is used to name ! 60: the code. */ ! 61: ! 62: #undef ASM_DECLARE_FUNCTION_NAME ! 63: #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ ! 64: do { \ ! 65: fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ ! 66: assemble_name (FILE, NAME); \ ! 67: putc (',', FILE); \ ! 68: fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ ! 69: putc ('\n', FILE); \ ! 70: ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ ! 71: if (TREE_PUBLIC (DECL)) \ ! 72: { \ ! 73: fprintf (FILE, "\t.globl ."); \ ! 74: assemble_name (FILE, NAME); \ ! 75: fprintf (FILE, "\n"); \ ! 76: } \ ! 77: data_section (); \ ! 78: ASM_OUTPUT_ALIGN (FILE, 2); \ ! 79: ASM_OUTPUT_LABEL (FILE, NAME); \ ! 80: fprintf (FILE, "\t.long ."); \ ! 81: assemble_name (FILE, NAME); \ ! 82: fprintf (FILE, ", __GOT0, 0\n"); \ ! 83: text_section (); \ ! 84: fprintf (FILE, "."); \ ! 85: ASM_OUTPUT_LABEL (FILE, NAME); \ ! 86: } while (0) ! 87: ! 88: /* We need to override the .size output in order to put a `.' before ! 89: the function name. */ ! 90: ! 91: #undef ASM_DECLARE_FUNCTION_SIZE ! 92: #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ ! 93: do { \ ! 94: if (!flag_inhibit_size_directive) \ ! 95: { \ ! 96: char label[256]; \ ! 97: static int labelno; \ ! 98: labelno++; \ ! 99: ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ ! 100: ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ ! 101: fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ ! 102: assemble_name (FILE, (FNAME)); \ ! 103: fprintf (FILE, ","); \ ! 104: assemble_name (FILE, label); \ ! 105: fprintf (FILE, "-."); \ ! 106: assemble_name (FILE, (FNAME)); \ ! 107: putc ('\n', FILE); \ ! 108: } \ ! 109: } while (0) ! 110: ! 111: /* Use ELF style section commands. */ ! 112: ! 113: #undef TEXT_SECTION_ASM_OP ! 114: #define TEXT_SECTION_ASM_OP "\t.section\t\".text\"" ! 115: ! 116: #undef DATA_SECTION_ASM_OP ! 117: #define DATA_SECTION_ASM_OP "\t.section\t\".data\"" ! 118: ! 119: /* Besides the usual ELF sections, we need a toc section. */ ! 120: ! 121: #undef EXTRA_SECTIONS ! 122: #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_toc ! 123: ! 124: #undef EXTRA_SECTION_FUNCTIONS ! 125: #define EXTRA_SECTION_FUNCTIONS \ ! 126: CONST_SECTION_FUNCTION \ ! 127: CTORS_SECTION_FUNCTION \ ! 128: DTORS_SECTION_FUNCTION \ ! 129: TOC_SECTION_FUNCTION ! 130: ! 131: #define TOC_SECTION_FUNCTION \ ! 132: void \ ! 133: toc_section () \ ! 134: { \ ! 135: if (TARGET_MINIMAL_TOC) \ ! 136: { \ ! 137: static int toc_initialized = 0; \ ! 138: \ ! 139: if (! toc_initialized) \ ! 140: { \ ! 141: fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \ ! 142: fprintf (asm_out_file, ".LCTOC0:\n"); \ ! 143: fprintf (asm_out_file, "\t.tc .LCTOC1\n"); \ ! 144: fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \ ! 145: fprintf (asm_out_file, ".LCTOC1:\n"); \ ! 146: toc_initialized = 1; \ ! 147: } \ ! 148: } \ ! 149: \ ! 150: if (in_section != in_toc) \ ! 151: { \ ! 152: fprintf (asm_out_file, "%s\n", \ ! 153: (TARGET_MINIMAL_TOC \ ! 154: ? MINIMAL_TOC_SECTION_ASM_OP \ ! 155: : TOC_SECTION_ASM_OP)); \ ! 156: in_section = in_toc; \ ! 157: } \ ! 158: } ! 159: ! 160: #define TOC_SECTION_ASM_OP "\t.section\t.got,\"aw\"" ! 161: #define MINIMAL_TOC_SECTION_ASM_OP "\t.section\t.got1,\"aw\"" ! 162: ! 163: /* Use the TOC section for TOC entries. */ ! 164: ! 165: #undef SELECT_RTX_SECTION ! 166: #define SELECT_RTX_SECTION(MODE, X) \ ! 167: { if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \ ! 168: toc_section (); \ ! 169: else \ ! 170: const_section (); \ ! 171: } ! 172: ! 173: /* How to renumber registers for dbx and gdb. */ ! 174: ! 175: #define DBX_REGISTER_NUMBER(REGNO) (REGNO) ! 176: ! 177: /* svr4.h overrides ASM_OUTPUT_INTERNAL_LABEL. */ ! 178: ! 179: #undef ASM_OUTPUT_INTERNAL_LABEL_PREFIX ! 180: #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \ ! 181: fprintf (FILE, ".%s", PREFIX) ! 182: ! 183: /* Pass -m601 to the assembler, since that is what powerpc.h currently ! 184: implies. */ ! 185: #undef ASM_SPEC ! 186: #define ASM_SPEC \ ! 187: "-u -m601 %{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}" ! 188: /* This is the end of what might become sysv4.h. */ ! 189: ! 190: /* Enable output of DBX (stabs) debugging information when asked for it. */ ! 191: ! 192: #define DBX_DEBUGGING_INFO ! 193: ! 194: /* Prefer DBX (stabs) debugging information over the native (DWARF) format. */ ! 195: ! 196: #undef PREFERRED_DEBUGGING_TYPE ! 197: #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG ! 198: ! 199: /* Line numbers are relative to the current function. */ ! 200: ! 201: #undef ASM_OUTPUT_SOURCE_LINE ! 202: #define ASM_OUTPUT_SOURCE_LINE(file, line) \ ! 203: { static int sym_lineno = 1; \ ! 204: fprintf (file, ".stabn 68,0,%d,.LM%d-.%s\n.LM%d:\n",\ ! 205: line, sym_lineno, \ ! 206: XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0), \ ! 207: sym_lineno); \ ! 208: sym_lineno += 1; } ! 209: ! 210: /* But, to make this work, we have to output the stabs for the function ! 211: name *first*... */ ! 212: ! 213: #define DBX_FUNCTION_FIRST ! 214: ! 215: /* We need to output LBRAC and RBRAC lines specially to include the ! 216: dot in from of the text symbol for a function. */ ! 217: ! 218: #define DBX_OUTPUT_LBRAC(FILE, BUF) \ ! 219: do \ ! 220: { \ ! 221: fprintf (FILE, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC); \ ! 222: assemble_name (FILE, BUF); \ ! 223: fprintf (FILE, "-."); \ ! 224: assemble_name (asmfile, \ ! 225: XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ ! 226: fprintf (asmfile, "\n"); \ ! 227: } \ ! 228: while (0) ! 229: ! 230: #define DBX_OUTPUT_RBRAC(FILE, BUF) \ ! 231: do \ ! 232: { \ ! 233: fprintf (FILE, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC); \ ! 234: assemble_name (FILE, BUF); \ ! 235: fprintf (FILE, "-."); \ ! 236: assemble_name (asmfile, \ ! 237: XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ ! 238: fprintf (asmfile, "\n"); \ ! 239: } \ ! 240: while (0) ! 241: ! 242: /* We are using function descriptors, so the value of a function ! 243: symbol is in the .data section. However, we want the stabs entry ! 244: for that function to point at the actual function code in the .text ! 245: section, which we get by prefixing the symbol with a dot. */ ! 246: ! 247: #define DBX_FINISH_SYMBOL(sym) \ ! 248: do { \ ! 249: int line = 0; \ ! 250: if (use_gnu_debug_info_extensions && sym != 0) \ ! 251: line = DECL_SOURCE_LINE (sym); \ ! 252: \ ! 253: fprintf (asmfile, "\",%d,0,%d,", current_sym_code, line); \ ! 254: if (current_sym_addr) \ ! 255: { \ ! 256: if (TREE_CODE (sym) == FUNCTION_DECL) \ ! 257: fprintf (asmfile, "."); \ ! 258: output_addr_const (asmfile, current_sym_addr); \ ! 259: } \ ! 260: else \ ! 261: fprintf (asmfile, "%d", current_sym_value); \ ! 262: putc ('\n', asmfile); \ ! 263: } while (0) ! 264: ! 265: /* This is the end of what might become sysv4dbx.h. */ ! 266: ! 267: #undef TARGET_VERSION ! 268: #define TARGET_VERSION fprintf (stderr, " (PowerPC Netware)"); ! 269: ! 270: /* FIXME: These should actually indicate PowerPC, when there is some ! 271: standard way of expressing that. */ ! 272: #undef CPP_PREDEFINES ! 273: #define CPP_PREDEFINES \ ! 274: "-DPPC D__netware__ -Asystem(netware) -Acpu(powerpc) -Amachine(powerpc)"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.