190075Sobrien/* Definitions for ARM running Linux-based GNU systems using ELF
2169689Skan   Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
3169689Skan   2005, 2006
490075Sobrien   Free Software Foundation, Inc.
590075Sobrien   Contributed by Philip Blundell <philb@gnu.org>
690075Sobrien
7132718Skan   This file is part of GCC.
890075Sobrien
9132718Skan   GCC is free software; you can redistribute it and/or modify it
10132718Skan   under the terms of the GNU General Public License as published
11132718Skan   by the Free Software Foundation; either version 2, or (at your
12132718Skan   option) any later version.
1390075Sobrien
14132718Skan   GCC is distributed in the hope that it will be useful, but WITHOUT
15132718Skan   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16132718Skan   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
17132718Skan   License for more details.
1890075Sobrien
19132718Skan   You should have received a copy of the GNU General Public License
20132718Skan   along with this program; see the file COPYING.  If not, write to
21169689Skan   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22169689Skan   Boston, MA 02110-1301, USA.  */
2390075Sobrien
2490075Sobrien/* elfos.h should have already been included.  Now just override
2590075Sobrien   any conflicting definitions and add any extras.  */
2690075Sobrien
2790075Sobrien/* Run-time Target Specification.  */
2890075Sobrien#undef  TARGET_VERSION
2990075Sobrien#define TARGET_VERSION  fputs (" (ARM GNU/Linux with ELF)", stderr);
3090075Sobrien
31169689Skan#undef  TARGET_DEFAULT_FLOAT_ABI
32169689Skan#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
3390075Sobrien
3490075Sobrien#undef  TARGET_DEFAULT
35169689Skan#define TARGET_DEFAULT (0)
3690075Sobrien
37132718Skan#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
38132718Skan
3990075Sobrien#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
4090075Sobrien
4190075Sobrien#undef  MULTILIB_DEFAULTS
4290075Sobrien#define MULTILIB_DEFAULTS \
43169689Skan	{ "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
4490075Sobrien
4590075Sobrien/* Now we define the strings used to build the spec file.  */
46132718Skan#undef  LIB_SPEC
4790075Sobrien#define LIB_SPEC \
48117395Skan  "%{pthread:-lpthread} \
49117395Skan   %{shared:-lc} \
50117395Skan   %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
5190075Sobrien
52169689Skan#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
5390075Sobrien
54169689Skan#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
5590075Sobrien
56169689Skan#define LINUX_TARGET_LINK_SPEC  "%{h*} %{version:-v} \
57169689Skan   %{b} \
5890075Sobrien   %{static:-Bstatic} \
5990075Sobrien   %{shared:-shared} \
6090075Sobrien   %{symbolic:-Bsymbolic} \
6190075Sobrien   %{rdynamic:-export-dynamic} \
62169689Skan   %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "} \
6390075Sobrien   -X \
6490075Sobrien   %{mbig-endian:-EB}" \
6590075Sobrien   SUBTARGET_EXTRA_LINK_SPEC
6690075Sobrien
67169689Skan#undef  LINK_SPEC
68169689Skan#define LINK_SPEC LINUX_TARGET_LINK_SPEC
6990075Sobrien
70169689Skan#define TARGET_OS_CPP_BUILTINS()		\
71169689Skan  do						\
72169689Skan    {						\
73169689Skan	LINUX_TARGET_OS_CPP_BUILTINS();		\
74169689Skan    }						\
75169689Skan  while (0)
76169689Skan
7790075Sobrien/* This is how we tell the assembler that two symbols have the same value.  */
7890075Sobrien#define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \
7990075Sobrien  do					   \
8090075Sobrien    {					   \
8190075Sobrien      assemble_name (FILE, NAME1); 	   \
8290075Sobrien      fputs (" = ", FILE);		   \
8390075Sobrien      assemble_name (FILE, NAME2);	   \
8490075Sobrien      fputc ('\n', FILE);		   \
8590075Sobrien    }					   \
8690075Sobrien  while (0)
8790075Sobrien
8890075Sobrien/* NWFPE always understands FPA instructions.  */
89132718Skan#undef  FPUTYPE_DEFAULT
90132718Skan#define FPUTYPE_DEFAULT FPUTYPE_FPA_EMU3
9190075Sobrien
9290075Sobrien/* Call the function profiler with a given profile label.  */
9390075Sobrien#undef  ARM_FUNCTION_PROFILER
9490075Sobrien#define ARM_FUNCTION_PROFILER(STREAM, LABELNO)  			\
9590075Sobrien{									\
96169689Skan  fprintf (STREAM, "\tbl\tmcount%s\n",					\
97169689Skan	   (TARGET_ARM && NEED_PLT_RELOC) ? "(PLT)" : "");		\
9890075Sobrien}
9990075Sobrien
100169689Skan/* The GNU/Linux profiler clobbers the link register.  Make sure the
101132718Skan   prologue knows to save it.  */
102132718Skan#define PROFILE_HOOK(X)						\
103132718Skan  emit_insn (gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (SImode, LR_REGNUM)))
104132718Skan
105169689Skan/* The GNU/Linux profiler needs a frame pointer.  */
106169689Skan#define SUBTARGET_FRAME_POINTER_REQUIRED current_function_profile
107