1/* Definitions for SH running OpenBSD using ELF 2 Copyright (C) 2002, 2006 Free Software Foundation, Inc. 3 Adapted from the NetBSD configuration contributed by Wasabi Systems, Inc. 4 5This file is part of GNU CC. 6 7GNU CC is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 2, or (at your option) 10any later version. 11 12GNU CC is distributed in the hope that it will be useful, 13but WITHOUT ANY WARRANTY; without even the implied warranty of 14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15GNU General Public License for more details. 16 17You should have received a copy of the GNU General Public License 18along with this program; see the file COPYING. If not, write to 19the Free Software Foundation, 59 Temple Place - Suite 330, 20Boston, MA 02111-1307, USA. */ 21 22/* Get generic OpenBSD definitions. */ 23#include <openbsd.h> 24 25#undef TARGET_CPU_DEFAULT 26#define TARGET_CPU_DEFAULT SELECT_SH4 27 28#undef TARGET_DEFAULT 29#define TARGET_DEFAULT \ 30 (TARGET_CPU_DEFAULT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT) 31 32#define TARGET_OS_CPP_BUILTINS() OPENBSD_OS_CPP_BUILTINS_ELF() 33 34/* Layout of source language data types */ 35 36/* This must agree with <machine/_types.h> */ 37#undef SIZE_TYPE 38#define SIZE_TYPE "long unsigned int" 39 40#undef PTRDIFF_TYPE 41#define PTRDIFF_TYPE "long int" 42 43#undef INTMAX_TYPE 44#define INTMAX_TYPE "long long int" 45 46#undef UINTMAX_TYPE 47#define UINTMAX_TYPE "long long unsigned int" 48 49#undef WCHAR_TYPE 50#define WCHAR_TYPE "int" 51 52#undef WCHAR_TYPE_SIZE 53#define WCHAR_TYPE_SIZE 32 54 55#undef LINK_DEFAULT_CPU_EMUL 56#define LINK_DEFAULT_CPU_EMUL "" 57 58#undef SUBTARGET_LINK_EMUL_SUFFIX 59#define SUBTARGET_LINK_EMUL_SUFFIX "_obsd" 60 61#undef SUBTARGET_LINK_SPEC 62#ifdef OBSD_NO_DYNAMIC_LIBRARIES 63#define SUBTARGET_LINK_SPEC \ 64 "%{g:%{!nostdlib:-L/usr/lib/debug}} %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp %{assert*}" 65#else 66#define SUBTARGET_LINK_SPEC \ 67 "%{g:%{!nostdlib:-L/usr/lib/debug}} \ 68 %{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \ 69 %{shared:-Bshareable -x} -dc -dp %{R*} \ 70 %{static:-Bstatic} \ 71 %{rdynamic:-export-dynamic} \ 72 %{assert*} \ 73 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}" 74#endif 75 76 77#undef LINK_SPEC 78#define LINK_SPEC SH_LINK_SPEC 79 80/* As an elf system, we need crtbegin/crtend stuff. */ 81#undef STARTFILE_SPEC 82#define STARTFILE_SPEC "\ 83 %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \ 84 crtbegin%O%s} %{shared:crtbeginS%O%s}" 85#undef ENDFILE_SPEC 86#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}" 87 88#undef PREFERRED_DEBUGGING_TYPE 89#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG 90 91/* Provide a CPP_SPEC appropriate for OpenBSD. */ 92#undef SUBTARGET_CPP_SPEC 93#define SUBTARGET_CPP_SPEC OBSD_CPP_SPEC 94 95/* Define because we use the label and we do not need them. */ 96#define NO_PROFILE_COUNTERS 97 98#undef FUNCTION_PROFILER 99#define FUNCTION_PROFILER(STREAM,LABELNO) \ 100do \ 101 { \ 102 if (TARGET_SHMEDIA32) \ 103 { \ 104 /* FIXME */ \ 105 abort (); \ 106 } \ 107 else if (TARGET_SHMEDIA64) \ 108 { \ 109 /* FIXME */ \ 110 abort (); \ 111 } \ 112 else \ 113 { \ 114 fprintf((STREAM), "\tmov.l\t%sLP%d,r1\n", \ 115 LOCAL_LABEL_PREFIX, (LABELNO)); \ 116 fprintf((STREAM), "\tmova\t%sLP%dr,r0\n", \ 117 LOCAL_LABEL_PREFIX, (LABELNO)); \ 118 fprintf((STREAM), "\tjmp\t@r1\n"); \ 119 fprintf((STREAM), "\tnop\n"); \ 120 fprintf((STREAM), "\t.align\t2\n"); \ 121 fprintf((STREAM), "%sLP%d:\t.long\t__mcount\n", \ 122 LOCAL_LABEL_PREFIX, (LABELNO)); \ 123 fprintf((STREAM), "%sLP%dr:\n", LOCAL_LABEL_PREFIX, (LABELNO)); \ 124 } \ 125 } \ 126while (0) 127