1/* Definitions of target machine for GNU compiler.  ARM RISCiX version.
2   Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
3   Contributed by Richard Earnshaw (rwe11@cl.cam.ac.uk), based on original
4	      work by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
5   	      and Martin Simmons (@harleqn.co.uk).
6
7This file is part of GNU CC.
8
9GNU CC is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 2, or (at your option)
12any later version.
13
14GNU CC is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with GNU CC; see the file COPYING.  If not, write to
21the Free Software Foundation, 59 Temple Place - Suite 330,
22Boston, MA 02111-1307, USA.  */
23
24/* Translation to find startup files.  On RISC iX boxes,
25   crt0, mcrt0 and gcrt0.o are in /usr/lib.  */
26#define STARTFILE_SPEC  "\
27  %{pg:/usr/lib/gcrt0.o%s}\
28  %{!pg:%{p:/usr/lib/mcrt0.o%s}\
29        %{!p:/usr/lib/crt0.o%s}}"
30
31/* RISC iX has no concept of -lg */
32/* If -static is specified then link with -lc_n */
33
34#ifndef LIB_SPEC
35#define LIB_SPEC "\
36  %{g*:-lg}\
37  %{!p:%{!pg:%{!static:-lc}%{static:-lc_n}}}\
38  %{p:-lc_p}\
39  %{pg:-lc_p}"
40#endif
41
42/* The RISC iX assembler never deletes any symbols from the object module;
43   and, by default, ld doesn't either.  -X causes local symbols starting
44   with 'L' to be deleted, which is what we want.  */
45#ifndef LINK_SPEC
46#define LINK_SPEC "-X"
47#endif
48
49#ifndef CPP_PREDEFINES
50#define CPP_PREDEFINES  \
51    "-Darm -Driscix -Dunix -Asystem(unix) -Acpu(arm) -Amachine(arm)"
52#endif
53
54
55/* RISCiX has some weird symbol name munging, that is done to the object module
56   after assembly, which enables multiple libraries to be supported within
57   one (possibly shared) library.  It basically changes the symbol name of
58   certain symbols (for example _bcopy is converted to _$bcopy if using BSD)
59   Symrename's parameters are determined as follows:
60     -mno-symrename	Don't run symrename
61     -mbsd	symrename -BSD <file>
62     -mxopen	symrename -XOPEN <file>
63     -ansi	symrename - <file>
64     <none>	symrename -BSD <file>
65 */
66
67#ifndef ASM_FINAL_SPEC
68#if !defined (CROSS_COMPILE)
69#define ASM_FINAL_SPEC "\
70%{!mno-symrename: \
71	\n /usr/bin/symrename \
72	-%{mbsd:%{pedantic:%e-mbsd and -pedantic incompatible}BSD}\
73%{mxopen:%{mbsd:%e-mbsd and -mxopen incompatible}\
74%{pedantic:%e-mxopen and -pedantic incompatible}XOPEN}\
75%{!mbsd:%{!mxopen:%{!ansi:BSD}}} %{c:%{o*:%*}%{!o*:%b.o}}%{!c:%U.o}}"
76#endif
77#endif
78
79/* None of these is actually used in cc1.  If we don't define them in target
80   switches cc1 complains about them.  For the sake of argument lets allocate
81   bit 31 of target flags for such options.  */
82#define SUBTARGET_SWITCHES						\
83  {"bsd",	   0x80000000, "Do symbol renaming for BSD"},		\
84  {"xopen",	   0x80000000, "Do symbol renaming for X/OPEN"},	\
85  {"no-symrename", 0x80000000, "Don't do symbol renaming"},
86
87
88/* Run-time Target Specification.  */
89#define TARGET_VERSION  \
90  fputs (" (ARM/RISCiX)", stderr);
91
92/* This is used in ASM_FILE_START */
93#define ARM_OS_NAME "RISCiX"
94
95/* Unsigned chars produces much better code than signed.  */
96#define DEFAULT_SIGNED_CHAR  0
97
98/* Define this if the target system supports the function atexit from the
99   ANSI C standard.  If this is not defined, and INIT_SECTION_ASM_OP is not
100   defined, a default exit function will be provided to support C++.
101   The man page only describes on_exit, but atexit is also there.  */
102#define HAVE_ATEXIT 1
103
104/* Some systems use __main in a way incompatible with its use in gcc, in these
105   cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
106   give the same symbol without quotes for an alternative entry point.  You
107   must define both, or neither. */
108#ifndef NAME__MAIN
109#define NAME__MAIN "__gccmain"
110#define SYMBOL__MAIN __gccmain
111#endif
112
113/* size_t is "unsigned int" in RISCiX */
114#define SIZE_TYPE "unsigned int"
115
116/* ptrdiff_t is "int" in RISCiX */
117#define PTRDIFF_TYPE "int"
118
119/* Maths operation domain error number, EDOM */
120#define TARGET_EDOM 33
121
122/* Override the normal default CPU */
123#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm2
124
125/* r10 is reserved by RISCiX  */
126#define SUBTARGET_CONDITIONAL_REGISTER_USAGE 	\
127  fixed_regs[10] = 1;				\
128  call_used_regs[10] = 1;
129
130#include "arm/aout.h"
131
132/* The RISCiX assembler does not understand .set */
133#undef SET_ASM_OP
134
135/* Override CPP_SPEC, there's no point handling endianness (and probably
136   not much point handling apcs_pc), and we want to add the right #defines
137   when using the include files.  */
138#undef CPP_SPEC
139#define CPP_SPEC "%(cpp_cpu_arch) %(cpp_apcs_pc) %(cpp_float) \
140	%{mbsd:%{pedantic:%e-mbsd and -pedantic incompatible} -D_BSD_C} \
141	%{mxopen:%{mbsd:%e-mbsd and -mxopen incompatible} 		\
142	  %{pedantic:%e-mxopen and -pedantic incompatible} -D_XOPEN_C}  \
143	%{!mbsd:%{!mxopen:%{!ansi: -D_BSD_C}}}"
144
145/* The native RISCiX assembler does not support stabs of any kind; because
146   the native assembler is not used by the compiler, Acorn didn't feel it was
147   necessary to put them in!  */
148
149#ifdef DBX_DEBUGGING_INFO
150#undef DBX_DEBUGGING_INFO
151#endif
152