1  /* Definitions of target machine for GNU compiler, NetBSD/arm ELF version.
       2     Copyright (C) 2002-2023 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 it
       8     under the terms of the GNU General Public License as published
       9     by the Free Software Foundation; either version 3, or (at your
      10     option) any later version.
      11  
      12     GCC is distributed in the hope that it will be useful, but WITHOUT
      13     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
      14     or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
      15     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  #undef MULTILIB_DEFAULTS
      23  #define MULTILIB_DEFAULTS { "mabi=aapcs-linux" }
      24  
      25  #define TARGET_LINKER_EABI_SUFFIX_SOFT \
      26    "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=hard:_eabihf;:_eabi}}}"
      27  #define TARGET_LINKER_EABI_SUFFIX_HARD \
      28    "%{!mabi=apcs-gnu:%{!mabi=atpcs:%{mfloat-abi=soft:_eabi;:_eabihf}}}"
      29  
      30  #define TARGET_LINKER_EABI_SUFFIX			\
      31    (TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_SOFT	\
      32     ? TARGET_LINKER_EABI_SUFFIX_SOFT			\
      33     : TARGET_LINKER_EABI_SUFFIX_HARD)
      34  
      35  #define TARGET_LINKER_BIG_EMULATION "armelfb_nbsd%(linker_eabi_suffix)"
      36  #define TARGET_LINKER_LITTLE_EMULATION "armelf_nbsd%(linker_eabi_suffix)"
      37  
      38  /* TARGET_BIG_ENDIAN_DEFAULT is set in
      39     config.gcc for big endian configurations.  */
      40  #undef  TARGET_LINKER_EMULATION
      41  #if TARGET_BIG_ENDIAN_DEFAULT
      42  #define TARGET_LINKER_EMULATION TARGET_LINKER_BIG_EMULATION
      43  #else
      44  #define TARGET_LINKER_EMULATION TARGET_LINKER_LITTLE_EMULATION
      45  #endif
      46  
      47  #undef ARM_DEFAULT_ABI
      48  #define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
      49  
      50  #undef ARM_UNWIND_INFO
      51  #define ARM_UNWIND_INFO 0
      52  #undef DWARF2_UNWIND_INFO
      53  #define DWARF2_UNWIND_INFO 1
      54  
      55  #undef TARGET_OS_CPP_BUILTINS
      56  #define TARGET_OS_CPP_BUILTINS()		\
      57    do						\
      58      {						\
      59        if (TARGET_AAPCS_BASED)			\
      60  	TARGET_BPABI_CPP_BUILTINS();		\
      61        NETBSD_OS_CPP_BUILTINS_ELF();		\
      62        if (DWARF2_UNWIND_INFO)			\
      63  	builtin_define ("__ARM_DWARF_EH__");	\
      64      }						\
      65    while (0)
      66  
      67  #undef SUBTARGET_CPP_SPEC
      68  #define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
      69  
      70  /*
      71   * Override AAPCS types to remain compatible the existing NetBSD types.
      72   */
      73  #undef WCHAR_TYPE
      74  #define WCHAR_TYPE "int"
      75  
      76  #undef SIZE_TYPE
      77  #define SIZE_TYPE "long unsigned int"
      78  
      79  #undef PTRDIFF_TYPE
      80  #define PTRDIFF_TYPE "long int"
      81  
      82  #undef SUBTARGET_EXTRA_ASM_SPEC
      83  #define SUBTARGET_EXTRA_ASM_SPEC		\
      84    "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu} "	\
      85    "%{fpic|fpie:-k} "				\
      86    "%{fPIC|fPIE:-k}"
      87  
      88  #undef SUBTARGET_EXTRA_SPECS
      89  #define SUBTARGET_EXTRA_SPECS						\
      90    { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC },		\
      91    { "linker_eabi_suffix",	TARGET_LINKER_EABI_SUFFIX },		\
      92    { "linker_emulation",		TARGET_LINKER_EMULATION },		\
      93    { "linker_big_emulation",	TARGET_LINKER_BIG_EMULATION },		\
      94    { "linker_little_emulation",	TARGET_LINKER_LITTLE_EMULATION },	\
      95    { "target_fix_v4bx_spec",	TARGET_FIX_V4BX_SPEC },			\
      96    NETBSD_SUBTARGET_EXTRA_SPECS
      97  
      98  #define NETBSD_ENTRY_POINT "__start"
      99  
     100  #undef LINK_SPEC
     101  #define LINK_SPEC						\
     102    "-X %{mbig-endian:-EB -m %(linker_big_emulation)} "		\
     103    "%{mlittle-endian:-EL -m %(linker_liitle_emulation)} "	\
     104    "%{!mbig-endian:%{!mlittle-endian:-m %(linker_emulation)}} "	\
     105    "%(target_fix_v4bx_spec) %(netbsd_link_spec)"