netbsd-elf.h revision 1.1.1.1.4.2
1/* Definitions for SH running NetBSD using ELF 2 Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. 3 Contributed by Wasabi Systems, Inc. 4 5This file is part of GCC. 6 7GCC 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 3, or (at your option) 10any later version. 11 12GCC 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 GCC; see the file COPYING3. If not see 19<http://www.gnu.org/licenses/>. */ 20 21/* Run-time Target Specification. */ 22#if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN 23#define TARGET_VERSION_ENDIAN "le" 24#else 25#define TARGET_VERSION_ENDIAN "" 26#endif 27 28#if TARGET_CPU_DEFAULT & MASK_SH5 29#if TARGET_CPU_DEFAULT & MASK_SH_E 30#define TARGET_VERSION_CPU "sh5" 31#else 32#define TARGET_VERSION_CPU "sh64" 33#endif /* MASK_SH_E */ 34#else 35#define TARGET_VERSION_CPU "sh" 36#endif /* MASK_SH5 */ 37 38#undef TARGET_VERSION 39#define TARGET_VERSION fprintf (stderr, " (NetBSD/%s%s ELF)", \ 40 TARGET_VERSION_CPU, TARGET_VERSION_ENDIAN) 41 42 43/* Extra specs needed for NetBSD SuperH ELF targets. */ 44 45#undef SUBTARGET_EXTRA_SPECS 46#define SUBTARGET_EXTRA_SPECS \ 47 { "netbsd_entry_point", NETBSD_ENTRY_POINT }, 48 49 50#define TARGET_OS_CPP_BUILTINS() \ 51 do \ 52 { \ 53 NETBSD_OS_CPP_BUILTINS_ELF(); \ 54 builtin_define ("__NO_LEADING_UNDERSCORES__"); \ 55 } \ 56 while (0) 57 58/* Provide a LINK_SPEC appropriate for a NetBSD/sh ELF target. 59 We use the SH_LINK_SPEC from sh/sh.h, and define the appropriate 60 SUBTARGET_LINK_SPEC that pulls in what we need from a generic 61 NetBSD ELF LINK_SPEC. */ 62 63/* LINK_EMUL_PREFIX from sh/elf.h */ 64 65#undef SUBTARGET_LINK_EMUL_SUFFIX 66#define SUBTARGET_LINK_EMUL_SUFFIX "_nbsd" 67 68#undef SUBTARGET_LINK_SPEC 69#define SUBTARGET_LINK_SPEC NETBSD_LINK_SPEC_ELF 70 71#undef LINK_SPEC 72#define LINK_SPEC SH_LINK_SPEC 73 74#define NETBSD_ENTRY_POINT "__start" 75 76/* Provide a CPP_SPEC appropriate for NetBSD. */ 77#undef SUBTARGET_CPP_SPEC 78#define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC 79 80#undef TARGET_DEFAULT 81#define TARGET_DEFAULT \ 82 (TARGET_CPU_DEFAULT | MASK_USERMODE | TARGET_ENDIAN_DEFAULT) 83 84/* Define because we use the label and we do not need them. */ 85#define NO_PROFILE_COUNTERS 1 86 87#undef FUNCTION_PROFILER 88#define FUNCTION_PROFILER(STREAM,LABELNO) \ 89do \ 90 { \ 91 if (TARGET_SHMEDIA32 || TARGET_SHMEDIA64) \ 92 { \ 93 /* FIXME */ \ 94 sorry ("unimplemented-shmedia profiling"); \ 95 } \ 96 else \ 97 { \ 98 fprintf((STREAM), "\tmov.l\t%sLP%d,r1\n", \ 99 LOCAL_LABEL_PREFIX, (LABELNO)); \ 100 fprintf((STREAM), "\tmova\t%sLP%dr,r0\n", \ 101 LOCAL_LABEL_PREFIX, (LABELNO)); \ 102 fprintf((STREAM), "\tjmp\t@r1\n"); \ 103 fprintf((STREAM), "\tnop\n"); \ 104 fprintf((STREAM), "\t.align\t2\n"); \ 105 fprintf((STREAM), "%sLP%d:\t.long\t__mcount\n", \ 106 LOCAL_LABEL_PREFIX, (LABELNO)); \ 107 fprintf((STREAM), "%sLP%dr:\n", LOCAL_LABEL_PREFIX, (LABELNO)); \ 108 } \ 109 } \ 110while (0) 111 112/* Since libgcc is compiled with -fpic for this target, we can't use 113 __sdivsi3_1 as the division strategy for -O0 and -Os. */ 114#undef SH_DIV_STRATEGY_DEFAULT 115#define SH_DIV_STRATEGY_DEFAULT SH_DIV_CALL2 116#undef SH_DIV_STR_FOR_SIZE 117#define SH_DIV_STR_FOR_SIZE "call2" 118