1 /* Definitions for LoongArch systems using GNU (glibc-based) userspace, 2 or other userspace with libc derived from glibc. 3 Copyright (C) 2021-2022 Free Software Foundation, 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 /* Define the size of the wide character type. */ 22 #undef WCHAR_TYPE 23 #define WCHAR_TYPE "int" 24 25 #undef WCHAR_TYPE_SIZE 26 #define WCHAR_TYPE_SIZE 32 27 28 29 /* GNU-specific SPEC definitions. */ 30 #define GNU_USER_LINK_EMULATION "elf" ABI_GRLEN_SPEC "loongarch" 31 32 #undef GLIBC_DYNAMIC_LINKER 33 #define GLIBC_DYNAMIC_LINKER \ 34 "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1" 35 36 #define MUSL_ABI_SPEC \ 37 "%{mabi=lp64d:}" \ 38 "%{mabi=lp64f:-sp}" \ 39 "%{mabi=lp64s:-sf}" 40 41 #undef MUSL_DYNAMIC_LINKER 42 #define MUSL_DYNAMIC_LINKER \ 43 "/lib/ld-musl-loongarch" ABI_GRLEN_SPEC MUSL_ABI_SPEC ".so.1" 44 45 #undef GNU_USER_TARGET_LINK_SPEC 46 #define GNU_USER_TARGET_LINK_SPEC \ 47 "%{G*} %{shared} -m " GNU_USER_LINK_EMULATION \ 48 "%{!shared: %{static} %{!static: %{rdynamic:-export-dynamic} " \ 49 "-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}" \ 50 "%{mno-relax: --no-relax}" 51 52 /* Similar to standard Linux, but adding -ffast-math support. */ 53 #undef GNU_USER_TARGET_MATHFILE_SPEC 54 #define GNU_USER_TARGET_MATHFILE_SPEC \ 55 "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" 56 57 #undef LIB_SPEC 58 #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC 59 60 #undef LINK_SPEC 61 #define LINK_SPEC GNU_USER_TARGET_LINK_SPEC 62 63 #undef ENDFILE_SPEC 64 #define ENDFILE_SPEC \ 65 GNU_USER_TARGET_MATHFILE_SPEC " " \ 66 GNU_USER_TARGET_ENDFILE_SPEC 67 68 #undef SUBTARGET_CPP_SPEC 69 #define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" 70 71 /* A standard GNU/Linux mapping. On most targets, it is included in 72 CC1_SPEC itself by config/linux.h, but loongarch.h overrides CC1_SPEC 73 and provides this hook instead. */ 74 #undef SUBTARGET_CC1_SPEC 75 #define SUBTARGET_CC1_SPEC GNU_USER_TARGET_CC1_SPEC 76 77 #define TARGET_OS_CPP_BUILTINS() \ 78 do \ 79 { \ 80 GNU_USER_TARGET_OS_CPP_BUILTINS (); \ 81 /* The GNU C++ standard library requires this. */ \ 82 if (c_dialect_cxx ()) \ 83 builtin_define ("_GNU_SOURCE"); \ 84 } \ 85 while (0) 86