1 /* Definitions for SH running NetBSD using ELF 2 Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 3 Contributed by Wasabi Systems, Inc. 4 5 This file is part of GCC. 6 7 GCC is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2, or (at your option) 10 any later version. 11 12 GCC is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; see the file COPYING. If not, write to 19 the Free Software Foundation, 51 Franklin Street, Fifth Floor, 20 Boston, MA 02110-1301, USA. */ 21 22 /* Run-time Target Specification. */ 23 #if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN 24 #define TARGET_VERSION_ENDIAN "le" 25 #else 26 #define TARGET_VERSION_ENDIAN "" 27 #endif 28 29 #if TARGET_CPU_DEFAULT & MASK_SH5 30 #if TARGET_CPU_DEFAULT & MASK_SH_E 31 #define TARGET_VERSION_CPU "sh5" 32 #else 33 #define TARGET_VERSION_CPU "sh64" 34 #endif /* MASK_SH_E */ 35 #else 36 #define TARGET_VERSION_CPU "sh" 37 #endif /* MASK_SH5 */ 38 39 #undef TARGET_VERSION 40 #define TARGET_VERSION fprintf (stderr, " (NetBSD/%s%s ELF)", \ 41 TARGET_VERSION_CPU, TARGET_VERSION_ENDIAN) 42 43 44 /* Extra specs needed for NetBSD SuperH ELF targets. */ 45 46 #undef SUBTARGET_EXTRA_SPECS 47 #define SUBTARGET_EXTRA_SPECS \ 48 { "netbsd_entry_point", NETBSD_ENTRY_POINT }, 49 50 51 #define TARGET_OS_CPP_BUILTINS() \ 52 do \ 53 { \ 54 NETBSD_OS_CPP_BUILTINS_ELF(); \ 55 builtin_define ("__NO_LEADING_UNDERSCORES__"); \ 56 } \ 57 while (0) 58 59 /* Provide a LINK_SPEC appropriate for a NetBSD/sh ELF target. 60 We use the SH_LINK_SPEC from sh/sh.h, and define the appropriate 61 SUBTARGET_LINK_SPEC that pulls in what we need from a generic 62 NetBSD ELF LINK_SPEC. */ 63 64 /* LINK_EMUL_PREFIX from sh/elf.h */ 65 66 #undef SUBTARGET_LINK_EMUL_SUFFIX 67 #define SUBTARGET_LINK_EMUL_SUFFIX "_nbsd" 68 69 #undef SUBTARGET_LINK_SPEC 70 #define SUBTARGET_LINK_SPEC NETBSD_LINK_SPEC_ELF 71 72 #undef LINK_SPEC 73 #define LINK_SPEC SH_LINK_SPEC 74 75 #define NETBSD_ENTRY_POINT "__start" 76 77 /* Provide a CPP_SPEC appropriate for NetBSD. */ 78 #undef SUBTARGET_CPP_SPEC 79 #define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC 80 81 #undef TARGET_DEFAULT 82 #define TARGET_DEFAULT \ 83 (TARGET_CPU_DEFAULT | MASK_USERMODE | TARGET_ENDIAN_DEFAULT) 84 85 /* Define because we use the label and we do not need them. */ 86 #define NO_PROFILE_COUNTERS 1 87 88 #undef FUNCTION_PROFILER 89 #define FUNCTION_PROFILER(STREAM,LABELNO) \ 90 do \ 91 { \ 92 if (TARGET_SHMEDIA32 || TARGET_SHMEDIA64) \ 93 { \ 94 /* FIXME */ \ 95 sorry ("unimplemented-shmedia profiling"); \ 96 } \ 97 else \ 98 { \ 99 fprintf((STREAM), "\tmov.l\t%sLP%d,r1\n", \ 100 LOCAL_LABEL_PREFIX, (LABELNO)); \ 101 fprintf((STREAM), "\tmova\t%sLP%dr,r0\n", \ 102 LOCAL_LABEL_PREFIX, (LABELNO)); \ 103 fprintf((STREAM), "\tjmp\t@r1\n"); \ 104 fprintf((STREAM), "\tnop\n"); \ 105 fprintf((STREAM), "\t.align\t2\n"); \ 106 fprintf((STREAM), "%sLP%d:\t.long\t__mcount\n", \ 107 LOCAL_LABEL_PREFIX, (LABELNO)); \ 108 fprintf((STREAM), "%sLP%dr:\n", LOCAL_LABEL_PREFIX, (LABELNO)); \ 109 } \ 110 } \ 111 while (0) 112 113 /* Since libgcc is compiled with -fpic for this target, we can't use 114 __sdivsi3_1 as the division strategy for -O0 and -Os. */ 115 #undef SH_DIV_STRATEGY_DEFAULT 116 #define SH_DIV_STRATEGY_DEFAULT SH_DIV_CALL2 117 #undef SH_DIV_STR_FOR_SIZE 118 #define SH_DIV_STR_FOR_SIZE "call2" 119