1 /* Base configuration file for all NetBSD targets. 2 Copyright (C) 1997-2020 Free Software Foundation, Inc. 3 4 This file is part of GCC. 5 6 GCC is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3, or (at your option) 9 any later version. 10 11 GCC is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GCC; see the file COPYING3. If not see 18 <http://www.gnu.org/licenses/>. */ 19 20 /* TARGET_OS_CPP_BUILTINS() common to all NetBSD targets. */ 21 #define NETBSD_OS_CPP_BUILTINS_COMMON() \ 22 do \ 23 { \ 24 builtin_define ("__NetBSD__"); \ 25 builtin_define ("__unix__"); \ 26 builtin_define ("__syslog_attribute__"); \ 27 builtin_assert ("system=bsd"); \ 28 builtin_assert ("system=unix"); \ 29 builtin_assert ("system=NetBSD"); \ 30 } \ 31 while (0) 32 33 /* CPP_SPEC parts common to all NetBSD targets. */ 34 #define NETBSD_CPP_SPEC \ 35 "%{posix:-D_POSIX_SOURCE} \ 36 %{pthread:-D_REENTRANT -D_PTHREADS}" 37 38 /* NETBSD_NATIVE is defined when gcc is integrated into the NetBSD 39 source tree so it can be configured appropriately without using 40 the GNU configure/build mechanism. 41 42 NETBSD_TOOLS is defined when gcc is built as cross-compiler for 43 the in-tree toolchain. 44 */ 45 46 #if defined(NETBSD_NATIVE) || defined(NETBSD_TOOLS) 47 48 /* Look for the include files in the system-defined places. */ 49 50 #undef GPLUSPLUS_INCLUDE_DIR 51 #define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" 52 53 #undef GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT 54 #define GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT 1 55 56 #undef GPLUSPLUS_BACKWARD_INCLUDE_DIR 57 #define GPLUSPLUS_BACKWARD_INCLUDE_DIR "/usr/include/g++/backward" 58 59 #undef GCC_INCLUDE_DIR_ADD_SYSROOT 60 #define GCC_INCLUDE_DIR_ADD_SYSROOT 1 61 62 /* 63 * XXX figure out a better way to do this 64 */ 65 #undef GCC_INCLUDE_DIR 66 #define GCC_INCLUDE_DIR "/usr/include/gcc-10" 67 68 /* Under NetBSD, the normal location of the various *crt*.o files is the 69 /usr/lib directory. */ 70 71 #undef STANDARD_STARTFILE_PREFIX 72 #define STANDARD_STARTFILE_PREFIX "/usr/lib/" 73 #undef STANDARD_STARTFILE_PREFIX_1 74 #define STANDARD_STARTFILE_PREFIX_1 "/usr/lib/" 75 76 #endif /* NETBSD_NATIVE || NETBSD_TOOLS */ 77 78 #if defined(NETBSD_NATIVE) 79 /* Under NetBSD, the normal location of the compiler back ends is the 80 /usr/libexec directory. */ 81 82 #undef STANDARD_EXEC_PREFIX 83 #define STANDARD_EXEC_PREFIX "/usr/libexec/" 84 85 #undef TOOLDIR_BASE_PREFIX 86 #define TOOLDIR_BASE_PREFIX "../" 87 88 #undef STANDARD_BINDIR_PREFIX 89 #define STANDARD_BINDIR_PREFIX "/usr/bin" 90 91 #undef STANDARD_LIBEXEC_PREFIX 92 #define STANDARD_LIBEXEC_PREFIX STANDARD_EXEC_PREFIX 93 94 #endif /* NETBSD_NATIVE */ 95 96 97 /* Provide a LIB_SPEC appropriate for NetBSD. Here we: 98 99 1. Select the appropriate set of libs, depending on whether we're 100 profiling. 101 102 2. Include the pthread library if -pthread is specified. 103 104 3. Include the posix library if -posix is specified. */ 105 106 #define NETBSD_LIB_SPEC \ 107 "%{pthread: \ 108 %{!p: \ 109 %{!pg:-lpthread}} \ 110 %{p:-lpthread_p} \ 111 %{pg:-lpthread_p}} \ 112 %{posix: \ 113 %{!p: \ 114 %{!pg:-lposix}} \ 115 %{p:-lposix_p} \ 116 %{pg:-lposix_p}} \ 117 %{shared: \ 118 %{!p: \ 119 %{!pg:-lc}} \ 120 %{p:-lc_p} \ 121 %{pg:-lc_p}} \ 122 %{!shared: \ 123 %{!symbolic: \ 124 %{!p: \ 125 %{!pg:-lc}} \ 126 %{p:-lc_p} \ 127 %{pg:-lc_p}}}" 128 129 #undef LIB_SPEC 130 #define LIB_SPEC NETBSD_LIB_SPEC 131 132 #define LIBSTDCXX_PROFILE "stdc++_p" 133 #define MATH_LIBRARY_PROFILE "m_p" 134 135 /* Provide a LIBGCC_SPEC appropriate for NetBSD. */ 136 #ifdef NETBSD_NATIVE 137 #define NETBSD_LIBGCC_SPEC \ 138 "%{!symbolic: \ 139 %{!shared: \ 140 %{!p: \ 141 %{!pg: -lgcc}}} \ 142 %{shared: -lgcc_pic} \ 143 %{p: -lgcc_p} \ 144 %{pg: -lgcc_p}}" 145 #else 146 #define NETBSD_LIBGCC_SPEC "-lgcc" 147 #endif 148 149 /* Pass -cxx-isystem to cc1/cc1plus. */ 150 #define NETBSD_CC1_AND_CC1PLUS_SPEC \ 151 "%{cxx-isystem}" 152 153 #undef CC1_SPEC 154 #define CC1_SPEC NETBSD_CC1_AND_CC1PLUS_SPEC 155 156 #undef CC1PLUS_SPEC 157 #define CC1PLUS_SPEC NETBSD_CC1_AND_CC1PLUS_SPEC 158 159 #if defined(HAVE_LD_EH_FRAME_HDR) 160 #define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} " 161 #endif 162 163 #undef TARGET_LIBC_HAS_FUNCTION 164 #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function 165 166 /* When building shared libraries, the initialization and finalization 167 functions for the library are .init and .fini respectively. */ 168 169 #define COLLECT_SHARED_INIT_FUNC(STREAM,FUNC) \ 170 do { \ 171 fprintf ((STREAM), "void __init() __asm__ (\".init\");"); \ 172 fprintf ((STREAM), "void __init() {\n\t%s();\n}\n", (FUNC)); \ 173 } while (0) 174 175 #define COLLECT_SHARED_FINI_FUNC(STREAM,FUNC) \ 176 do { \ 177 fprintf ((STREAM), "void __fini() __asm__ (\".fini\");"); \ 178 fprintf ((STREAM), "void __fini() {\n\t%s();\n}\n", (FUNC)); \ 179 } while (0) 180 181 #undef TARGET_POSIX_IO 182 #define TARGET_POSIX_IO 183 184 /* Define some types that are the same on all NetBSD platforms, 185 making them agree with <machine/ansi.h>. */ 186 187 #undef WCHAR_TYPE 188 #define WCHAR_TYPE "int" 189 190 #undef WCHAR_TYPE_SIZE 191 #define WCHAR_TYPE_SIZE 32 192 193 #undef WINT_TYPE 194 #define WINT_TYPE "int" 195 196 /* Use --as-needed -lgcc_s for eh support. */ 197 #ifdef HAVE_LD_AS_NEEDED 198 #define USE_LD_AS_NEEDED 1 199 #endif 200 201 #undef SUBTARGET_INIT_BUILTINS 202 #define SUBTARGET_INIT_BUILTINS \ 203 do { \ 204 netbsd_patch_builtins (); \ 205 } while(0) 206 207 #if defined(HAVE_LD_STATIC_DYNAMIC) 208 #undef LIBTSAN_EARLY_SPEC 209 #define LIBTSAN_EARLY_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \ 210 " -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "} -lpthread" 211 #endif 212