1 /* Definitions for SH running NetBSD using ELF 2 Copyright (C) 2002-2020 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 3, 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 GCC; see the file COPYING3. If not see 19 <http://www.gnu.org/licenses/>. */ 20 21 /* Run-time Target Specification. */ 22 23 #define TARGET_OS_CPP_BUILTINS() \ 24 do \ 25 { \ 26 NETBSD_OS_CPP_BUILTINS_ELF(); \ 27 builtin_define ("__NO_LEADING_UNDERSCORES__"); \ 28 } \ 29 while (0) 30 31 /* Provide a LINK_SPEC appropriate for a NetBSD/sh ELF target. 32 We use the SH_LINK_SPEC from sh/sh.h, and define the appropriate 33 SUBTARGET_LINK_SPEC that pulls in what we need from a generic 34 NetBSD ELF LINK_SPEC. */ 35 36 /* LINK_EMUL_PREFIX from sh/elf.h */ 37 #undef SUBTARGET_LINK_EMUL_SUFFIX 38 #define SUBTARGET_LINK_EMUL_SUFFIX "_nbsd" 39 40 #undef SUBTARGET_LINK_SPEC 41 #define SUBTARGET_LINK_SPEC NETBSD_LINK_SPEC_ELF 42 43 #undef LINK_SPEC 44 #define LINK_SPEC SH_LINK_SPEC 45 46 #define NETBSD_ENTRY_POINT "__start" 47 48 /* Provide a CPP_SPEC appropriate for NetBSD. */ 49 #undef SUBTARGET_CPP_SPEC 50 #define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC 51 52 #undef TARGET_DEFAULT 53 #define TARGET_DEFAULT \ 54 (TARGET_CPU_DEFAULT | TARGET_ENDIAN_DEFAULT) 55 56 /* Define because we use the label and we do not need them. */ 57 #define NO_PROFILE_COUNTERS 1 58 59 #undef FUNCTION_PROFILER 60 #define FUNCTION_PROFILER(STREAM,LABELNO) \ 61 do \ 62 { \ 63 fprintf((STREAM), "\tmov.l\t%sLP%d,r1\n", \ 64 LOCAL_LABEL_PREFIX, (LABELNO)); \ 65 fprintf((STREAM), "\tmova\t%sLP%dr,r0\n", \ 66 LOCAL_LABEL_PREFIX, (LABELNO)); \ 67 fprintf((STREAM), "\tjmp\t@r1\n"); \ 68 fprintf((STREAM), "\tnop\n"); \ 69 fprintf((STREAM), "\t.align\t2\n"); \ 70 fprintf((STREAM), "%sLP%d:\t.long\t__mcount\n", \ 71 LOCAL_LABEL_PREFIX, (LABELNO)); \ 72 fprintf((STREAM), "%sLP%dr:\n", LOCAL_LABEL_PREFIX, (LABELNO)); \ 73 } \ 74 while (0) 75 76 #undef SUBTARGET_OVERRIDE_OPTIONS 77 #define SUBTARGET_OVERRIDE_OPTIONS \ 78 do \ 79 { \ 80 /* Set -musermode if it hasn't been specified. */ \ 81 if (global_options_set.x_TARGET_USERMODE == 0) \ 82 TARGET_USERMODE = true; \ 83 } \ 84 while (0) 85