1/* Definitions for DECstation running BSD as target machine for GNU compiler. 2 Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. 3 4This file is part of GNU CC. 5 6GNU CC is free software; you can redistribute it and/or modify 7it under the terms of the GNU General Public License as published by 8the Free Software Foundation; either version 2, or (at your option) 9any later version. 10 11GNU CC is distributed in the hope that it will be useful, 12but WITHOUT ANY WARRANTY; without even the implied warranty of 13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14GNU General Public License for more details. 15 16You should have received a copy of the GNU General Public License 17along with GNU CC; see the file COPYING. If not, write to 18the Free Software Foundation, 59 Temple Place - Suite 330, 19Boston, MA 02111-1307, USA. */ 20 21#define DECSTATION 22 23/* Look for the include files in the system-defined places. */ 24 25#ifndef CROSS_COMPILE 26#undef GPLUSPLUS_INCLUDE_DIR 27#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" 28 29#undef GCC_INCLUDE_DIR 30#define GCC_INCLUDE_DIR "/usr/include" 31 32#undef INCLUDE_DEFAULTS 33#define INCLUDE_DEFAULTS \ 34 { \ 35 { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ 36 { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \ 37 { 0, 0, 0, 0 } \ 38 } 39 40/* Under NetBSD, the normal location of the various *crt*.o files is the 41 /usr/lib directory. */ 42 43#undef STANDARD_STARTFILE_PREFIX 44#define STANDARD_STARTFILE_PREFIX "/usr/lib/" 45#endif 46 47/* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support 48 for the special GCC options -static, -assert, and -nostdlib. */ 49 50#undef LINK_SPEC 51#define LINK_SPEC \ 52 "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \ 53 %{!nostartfiles:%{!r*:%{!e*:-e __start}}} -dc -dp %{static:-Bstatic} %{assert*}" 54 55/* We have atexit(3). */ 56 57#define HAVE_ATEXIT 58 59/* Implicit library calls should use memcpy, not bcopy, etc. */ 60 61#define TARGET_MEM_FUNCTIONS 62 63/* Define mips-specific netbsd predefines... */ 64#ifndef CPP_PREDEFINES 65#define CPP_PREDEFINES "-D__ANSI_COMPAT \ 66-DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__NetBSD__ -Dmips \ 67-D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \ 68-Dunix -D_R3000 \ 69-Asystem(unix) -Asystem(NetBSD) -Amachine(mips)" 70#endif 71 72#ifndef SUBTARGET_CPP_SPEC 73#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE}" 74#endif 75 76#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" 77#define STARTFILE_SPEC "" 78 79#ifndef MACHINE_TYPE 80#define MACHINE_TYPE "NetBSD/pmax" 81#endif 82 83#define TARGET_DEFAULT MASK_GAS 84#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG 85 86#include "mips/mips.h" 87 88/* 89 * Some imports from svr4.h in support of shared libraries. 90 * Currently, we need the DECLARE_OBJECT_SIZE stuff. 91 */ 92 93/* Define the strings used for the special svr4 .type and .size directives. 94 These strings generally do not vary from one system running svr4 to 95 another, but if a given system (e.g. m88k running svr) needs to use 96 different pseudo-op names for these, they may be overridden in the 97 file which includes this one. */ 98 99#undef TYPE_ASM_OP 100#undef SIZE_ASM_OP 101#undef WEAK_ASM_OP 102#define TYPE_ASM_OP ".type" 103#define SIZE_ASM_OP ".size" 104#define WEAK_ASM_OP ".weak" 105 106/* The following macro defines the format used to output the second 107 operand of the .type assembler directive. Different svr4 assemblers 108 expect various different forms for this operand. The one given here 109 is just a default. You may need to override it in your machine- 110 specific tm.h file (depending upon the particulars of your assembler). */ 111 112#undef TYPE_OPERAND_FMT 113#define TYPE_OPERAND_FMT "@%s" 114 115/* Write the extra assembler code needed to declare a function's result. 116 Most svr4 assemblers don't require any special declaration of the 117 result value, but there are exceptions. */ 118 119#ifndef ASM_DECLARE_RESULT 120#define ASM_DECLARE_RESULT(FILE, RESULT) 121#endif 122 123/* These macros generate the special .type and .size directives which 124 are used to set the corresponding fields of the linker symbol table 125 entries in an ELF object file under SVR4. These macros also output 126 the starting labels for the relevant functions/objects. */ 127 128/* Write the extra assembler code needed to declare a function properly. 129 Some svr4 assemblers need to also have something extra said about the 130 function's return value. We allow for that here. */ 131 132#undef ASM_DECLARE_FUNCTION_NAME 133#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ 134 do { \ 135 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ 136 assemble_name (FILE, NAME); \ 137 putc (',', FILE); \ 138 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ 139 putc ('\n', FILE); \ 140 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ 141 } while (0) 142 143/* Write the extra assembler code needed to declare an object properly. */ 144 145#undef ASM_DECLARE_OBJECT_NAME 146#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ 147 do { \ 148 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ 149 assemble_name (FILE, NAME); \ 150 putc (',', FILE); \ 151 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ 152 putc ('\n', FILE); \ 153 size_directive_output = 0; \ 154 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ 155 { \ 156 size_directive_output = 1; \ 157 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 158 assemble_name (FILE, NAME); \ 159 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ 160 } \ 161 ASM_OUTPUT_LABEL(FILE, NAME); \ 162 } while (0) 163 164/* Output the size directive for a decl in rest_of_decl_compilation 165 in the case where we did not do so before the initializer. 166 Once we find the error_mark_node, we know that the value of 167 size_directive_output was set 168 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ 169 170#undef ASM_FINISH_DECLARE_OBJECT 171#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ 172do { \ 173 char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ 174 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ 175 && ! AT_END && TOP_LEVEL \ 176 && DECL_INITIAL (DECL) == error_mark_node \ 177 && !size_directive_output) \ 178 { \ 179 size_directive_output = 1; \ 180 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 181 assemble_name (FILE, name); \ 182 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ 183 } \ 184 } while (0) 185 186/* This is how to declare the size of a function. */ 187 188#undef ASM_DECLARE_FUNCTION_SIZE 189#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ 190 do { \ 191 if (!flag_inhibit_size_directive) \ 192 { \ 193 char label[256]; \ 194 static int labelno; \ 195 labelno++; \ 196 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ 197 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ 198 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 199 assemble_name (FILE, (FNAME)); \ 200 fprintf (FILE, ","); \ 201 assemble_name (FILE, label); \ 202 fprintf (FILE, "-"); \ 203 assemble_name (FILE, (FNAME)); \ 204 putc ('\n', FILE); \ 205 } \ 206 } while (0) 207 208/* 209 A C statement to output something to the assembler file to switch to section 210 NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or 211 NULL_TREE. Some target formats do not support arbitrary sections. Do not 212 define this macro in such cases. 213*/ 214#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \ 215do { \ 216 extern FILE *asm_out_text_file; \ 217 if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \ 218 fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \ 219 else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \ 220 fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \ 221 else \ 222 fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \ 223} while (0) 224 225/* Since gas and gld are standard on NetBSD, we don't need these */ 226#undef ASM_FINAL_SPEC 227#undef STARTFILE_SPEC 228