Add files that I missed when importing NaCl changes earlier
[gcc/nacl-gcc.git] / gcc / config / i386 / nacl.h
blob00e8304500ed877e900e992a11899f6cfc258683
1 /* Target definitions for GCC for NativeClient using ELF
2 Copyright (C) 1988, 1991, 1995, 2000, 2001, 2002
3 Free Software Foundation, Inc.
5 Derived from sysv4.h written by Ron Guilmette (rfg@netcom.com).
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
14 GCC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING. If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
24 /* These definitions modify those in i386elf.h. */
26 #undef TARGET_VERSION
27 #define TARGET_VERSION fprintf (stderr, " (NativeClient)");
29 /* Pass the NativeClient specific options to the assembler */
30 #undef ASM_SPEC
31 #define ASM_SPEC \
32 "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} " \
33 "%{fnacl-library-mode:-nacl-library-mode} " \
34 "%{fnacl-align-16:-nacl-align=4} " \
35 "%{fnacl-align-32:-nacl-align=5} " \
36 "%{Ym,*} %{Yd,*} %{Wa,*:%*}"
38 #undef LIB_SPEC
39 #define LIB_SPEC \
40 "%{pthread:-lpthread} \
41 %{shared:-lc} \
42 %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}} -lnacl -lsrpc"
45 * Set the linker emulation to be elf_nacl rather than linux.h's default
46 * (elf_i386).
48 #ifdef LINK_EMULATION
49 #undef LINK_EMULATION
50 #endif
51 #define LINK_EMULATION "elf_nacl"
54 * Because of NaCl's use of segment registers, negative offsets from gs: will
55 * not work. Hence we need to make TLS references explicitly compute the
56 * tls base pointer and then indirect relative to it using the default
57 * segment descriptor (DS). That is, instead of
58 * movl gs:i@NTPOFF, %ecx
59 * we use
60 * movl %gs:0, %eax
61 * movl i@NTPOFF(%eax), %ecx
62 * There is a slight performance penalty for TLS accesses, but there does not
63 * seem a way around it.
65 #undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT
66 #define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 0
68 #undef TARGET_OS_CPP_BUILTINS
69 #define TARGET_OS_CPP_BUILTINS() \
70 do \
71 { \
72 LINUX_TARGET_OS_CPP_BUILTINS(); \
73 builtin_define ("__native_client__=1"); \
74 } \
75 while (0)