(root)/
gcc-13.2.0/
gcc/
config/
loongarch/
gnu-user.h
       1  /* Definitions for LoongArch systems using GNU (glibc-based) userspace,
       2     or other userspace with libc derived from glibc.
       3     Copyright (C) 2021-2023 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  #undef MUSL_DYNAMIC_LINKER
      37  #define MUSL_DYNAMIC_LINKER \
      38    "/lib" ABI_GRLEN_SPEC "/ld-musl-loongarch-" ABI_SPEC ".so.1"
      39  
      40  #undef GNU_USER_TARGET_LINK_SPEC
      41  #define GNU_USER_TARGET_LINK_SPEC \
      42    "%{G*} %{shared} -m " GNU_USER_LINK_EMULATION \
      43    "%{!shared: %{static} " \
      44    "%{!static: %{!static-pie: %{rdynamic:-export-dynamic} " \
      45    "-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} " \
      46    "%{static-pie: -static -pie --no-dynamic-linker -z text}}"
      47  
      48  
      49  /* Similar to standard Linux, but adding -ffast-math support.  */
      50  #undef GNU_USER_TARGET_MATHFILE_SPEC
      51  #define GNU_USER_TARGET_MATHFILE_SPEC \
      52    "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
      53  
      54  #undef LIB_SPEC
      55  #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
      56  
      57  #undef LINK_SPEC
      58  #define LINK_SPEC GNU_USER_TARGET_LINK_SPEC
      59  
      60  #undef ENDFILE_SPEC
      61  #define ENDFILE_SPEC \
      62    GNU_USER_TARGET_MATHFILE_SPEC " " \
      63    GNU_USER_TARGET_ENDFILE_SPEC
      64  
      65  #undef SUBTARGET_CPP_SPEC
      66  #define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
      67  
      68  /* A standard GNU/Linux mapping.  On most targets, it is included in
      69     CC1_SPEC itself by config/linux.h, but loongarch.h overrides CC1_SPEC
      70     and provides this hook instead.  */
      71  #undef SUBTARGET_CC1_SPEC
      72  #define SUBTARGET_CC1_SPEC GNU_USER_TARGET_CC1_SPEC
      73  
      74  #define TARGET_OS_CPP_BUILTINS() \
      75    do \
      76      { \
      77        GNU_USER_TARGET_OS_CPP_BUILTINS (); \
      78        /* The GNU C++ standard library requires this.  */ \
      79        if (c_dialect_cxx ()) \
      80         builtin_define ("_GNU_SOURCE"); \
      81      } \
      82    while (0)