190075Sobrien/* Definitions for AMD x86-64 running Linux-based GNU systems with ELF format. 2169689Skan Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. 390075Sobrien Contributed by Jan Hubicka <jh@suse.cz>, based on linux.h. 490075Sobrien 5132718SkanThis file is part of GCC. 690075Sobrien 7132718SkanGCC is free software; you can redistribute it and/or modify 890075Sobrienit under the terms of the GNU General Public License as published by 990075Sobrienthe Free Software Foundation; either version 2, or (at your option) 1090075Sobrienany later version. 1190075Sobrien 12132718SkanGCC is distributed in the hope that it will be useful, 1390075Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1490075SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1590075SobrienGNU General Public License for more details. 1690075Sobrien 1790075SobrienYou should have received a copy of the GNU General Public License 18132718Skanalong with GCC; see the file COPYING. If not, write to 19169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 20169689SkanBoston, MA 02110-1301, USA. */ 2190075Sobrien 2290075Sobrien#define TARGET_VERSION fprintf (stderr, " (x86-64 Linux/ELF)"); 2390075Sobrien 24117395Skan#define TARGET_OS_CPP_BUILTINS() \ 25117395Skan do \ 26117395Skan { \ 27132718Skan LINUX_TARGET_OS_CPP_BUILTINS(); \ 28117395Skan } \ 29117395Skan while (0) 3090075Sobrien 3190075Sobrien#undef CPP_SPEC 32117395Skan#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" 3390075Sobrien 34107590Sobrien/* The svr4 ABI for the i386 says that records and unions are returned 35107590Sobrien in memory. In the 64bit compilation we will turn this flag off in 36107590Sobrien override_options, as we never do pcc_struct_return scheme on this target. */ 37107590Sobrien#undef DEFAULT_PCC_STRUCT_RETURN 38107590Sobrien#define DEFAULT_PCC_STRUCT_RETURN 1 39107590Sobrien 40132718Skan/* We arrange for the whole %fs segment to map the tls area. */ 41132718Skan#undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 42132718Skan#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS 43132718Skan 4490075Sobrien/* Provide a LINK_SPEC. Here we provide support for the special GCC 4590075Sobrien options -static and -shared, which allow us to link things in one 4690075Sobrien of these three modes by applying the appropriate combinations of 4790075Sobrien options at link-time. 4890075Sobrien 4990075Sobrien When the -shared link option is used a final link is not being 5090075Sobrien done. */ 5190075Sobrien 52169689Skan#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" 53169689Skan#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" 54169689Skan 5590075Sobrien#undef LINK_SPEC 56117395Skan#define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \ 5796263Sobrien %{shared:-shared} \ 5890075Sobrien %{!shared: \ 5990075Sobrien %{!static: \ 6090075Sobrien %{rdynamic:-export-dynamic} \ 61169689Skan %{m32:%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \ 62169689Skan %{!m32:%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}} \ 6396263Sobrien %{static:-static}}" 6490075Sobrien 65169689Skan/* Similar to standard Linux, but adding -ffast-math support. */ 66169689Skan#undef ENDFILE_SPEC 67169689Skan#define ENDFILE_SPEC \ 68169689Skan "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ 69169689Skan %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" 70169689Skan 71132718Skan#define MULTILIB_DEFAULTS { "m64" } 7296263Sobrien 73132718Skan#undef NEED_INDICATE_EXEC_STACK 74132718Skan#define NEED_INDICATE_EXEC_STACK 1 7596263Sobrien 76169689Skan#define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h" 7796263Sobrien 78169689Skan/* This macro may be overridden in i386/k*bsd-gnu.h. */ 79169689Skan#define REG_NAME(reg) reg 80169689Skan 81169689Skan#ifdef TARGET_LIBC_PROVIDES_SSP 82169689Skan/* i386 glibc provides __stack_chk_guard in %gs:0x14, 83169689Skan x86_64 glibc provides it in %fs:0x28. */ 84169689Skan#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) 8596263Sobrien#endif 86