Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: gcc/config/i386/nacl.h

Issue 6685112: Teach sandboxed GCC not to rely on inode numbers. (Closed) Base URL: http://git.chromium.org/git/nacl-gcc@master
Patch Set: rebased on top of master Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Target definitions for GCC for NativeClient using ELF 1 /* Target definitions for GCC for NativeClient using ELF
2 Copyright (C) 1988, 1991, 1995, 2000, 2001, 2002 2 Copyright (C) 1988, 1991, 1995, 2000, 2001, 2002
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5 Derived from sysv4.h written by Ron Guilmette (rfg@netcom.com). 5 Derived from sysv4.h written by Ron Guilmette (rfg@netcom.com).
6 6
7 This file is part of GCC. 7 This file is part of GCC.
8 8
9 GCC is free software; you can redistribute it and/or modify 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 10 it under the terms of the GNU General Public License as published by
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #else 50 #else
51 #define STARTFILE_SPEC \ 51 #define STARTFILE_SPEC \
52 "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \ 52 "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
53 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" 53 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
54 #endif 54 #endif
55 55
56 /* Provide a ENDFILE_SPEC. Here we tack on 56 /* Provide a ENDFILE_SPEC. Here we tack on
57 the GNU/Linux magical crtend.o file (see crtstuff.c) which provides part of 57 the GNU/Linux magical crtend.o file (see crtstuff.c) which provides part of
58 the support for getting C++ file-scope static object constructed before 58 the support for getting C++ file-scope static object constructed before
59 entering `main', followed by a normal GNU/Linux "finalizer" file, `crtn.o'. 59 entering `main', followed by a normal GNU/Linux "finalizer" file, `crtn.o'.
60 TODO(pasko): add -ffast-math support to ENDFILE_SPEC. 60 TODO(pasko): add -ffast-math support to ENDFILE_SPEC. */
61 */
62 61
63 #undef ENDFILE_SPEC 62 #undef ENDFILE_SPEC
64 #define ENDFILE_SPEC \ 63 #define ENDFILE_SPEC \
65 "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" 64 "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
66 65
67 /* This is for -profile to use -lc_p instead of -lc. */ 66 /* This is for -profile to use -lc_p instead of -lc. */
68 #ifndef CC1_SPEC 67 #ifndef CC1_SPEC
69 #define CC1_SPEC "%{profile:-p}" 68 #define CC1_SPEC "%{profile:-p}"
70 #endif 69 #endif
71 70
72 /* The GNU C++ standard library requires that these macros be defined. */ 71 /* The GNU C++ standard library requires that these macros be defined. */
73 #undef CPLUSPLUS_CPP_SPEC 72 #undef CPLUSPLUS_CPP_SPEC
74 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" 73 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
75 74
76 #undef LIB_SPEC 75 #undef LIB_SPEC
77 #define LIB_SPEC \ 76 #define LIB_SPEC \
78 "%{pthread:-lpthread} \ 77 "%{pthread:-lpthread} \
79 %{shared:-lc} \ 78 %{shared:-lc} \
80 %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}" 79 %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
81 80
82 /* Pass the NativeClient specific options to the assembler */ 81 /* Pass the NativeClient specific options to the assembler. */
83 #undef ASM_SPEC 82 #undef ASM_SPEC
84 #define ASM_SPEC \ 83 #define ASM_SPEC \
85 "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} " \ 84 "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} " \
86 "%{fnacl-library-mode:-nacl-library-mode} " \ 85 "%{fnacl-library-mode:-nacl-library-mode} " \
87 "%{fnacl-align-16:-nacl-align=4} " \ 86 "%{fnacl-align-16:-nacl-align=4} " \
88 "%{fnacl-align-32:-nacl-align=5} " \ 87 "%{fnacl-align-32:-nacl-align=5} " \
89 "%{Ym,*} %{Yd,*} %{Wa,*:%*} %{m32:--32} %{m64:--64} " \ 88 "%{Ym,*} %{Yd,*} %{Wa,*:%*} %{m32:--32} %{m64:--64} " \
90 "%{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" 89 "%{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
91 90
92 /* `crt_platform' contains low-level platform-specific intrinsics in C. */ 91 /* `crt_platform' contains low-level platform-specific intrinsics in C. */
93 #undef LIB_SPEC 92 #undef LIB_SPEC
94 #define LIB_SPEC \ 93 #define LIB_SPEC \
95 "%{pthread:-lpthread} \ 94 "%{pthread:-lpthread} \
96 %{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc} \ 95 %{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc} \
97 -lnacl \ 96 -lnacl \
98 %{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc} \ 97 %{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc} \
99 %{lnosys:-lnosys} \ 98 %{lnosys:-lnosys} \
100 -lcrt_platform \ 99 -lcrt_platform \
101 %{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}" 100 %{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}"
102 101
103 /* Define this so we can compile MS code for use with WINE. */ 102 /* Define this so we can compile MS code for use with WINE. */
104 #define HANDLE_PRAGMA_PACK_PUSH_POP 103 #define HANDLE_PRAGMA_PACK_PUSH_POP
105 104
106 #if defined(HAVE_LD_EH_FRAME_HDR) 105 #if defined(HAVE_LD_EH_FRAME_HDR)
107 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " 106 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
108 #endif 107 #endif
109 108
110 /* Use --as-needed -lgcc_s for eh support. */ 109 /* Use --as-needed -lgcc_s for eh support. */
111 #ifdef HAVE_LD_AS_NEEDED 110 #ifdef HAVE_LD_AS_NEEDED
112 #define USE_LD_AS_NEEDED 1 111 #define USE_LD_AS_NEEDED 1
113 #endif 112 #endif
114 113
115 /* TODO(pasko): replace LINUX_DYNAMIC_LINKER with NACL_DYNAMIC_LINKER when we 114 /* TODO(pasko): replace LINUX_DYNAMIC_LINKER with NACL_DYNAMIC_LINKER when we
116 * implement dynamic linking. 115 implement dynamic linking. */
117 */
118 116
119 /* Determine which dynamic linker to use depending on whether GLIBC or 117 /* Determine which dynamic linker to use depending on whether GLIBC or
120 uClibc is the default C library and whether -muclibc or -mglibc has 118 uClibc is the default C library and whether -muclibc or -mglibc has
121 been passed to change the default. */ 119 been passed to change the default. */
122 #if UCLIBC_DEFAULT 120 #if UCLIBC_DEFAULT
123 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:%{muclibc:%e-mglibc and -muclibc u sed together}" G ";:" U "}" 121 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:%{muclibc:%e-mglibc and -muclibc u sed together}" G ";:" U "}"
124 #else 122 #else
125 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:%{mglibc:%e-mglibc and -muclibc u sed together}" U ";:" G "}" 123 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:%{mglibc:%e-mglibc and -muclibc u sed together}" U ";:" G "}"
126 #endif 124 #endif
127 125
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 184
187 /* This macro may be overridden in i386/k*bsd-gnu.h. */ 185 /* This macro may be overridden in i386/k*bsd-gnu.h. */
188 #define REG_NAME(reg) reg 186 #define REG_NAME(reg) reg
189 187
190 #ifdef TARGET_LIBC_PROVIDES_SSP 188 #ifdef TARGET_LIBC_PROVIDES_SSP
191 /* i386 glibc provides __stack_chk_guard in %gs:0x14, 189 /* i386 glibc provides __stack_chk_guard in %gs:0x14,
192 x86_64 glibc provides it in %fs:0x28. */ 190 x86_64 glibc provides it in %fs:0x28. */
193 #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) 191 #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14)
194 #endif 192 #endif
195 193
196 /* 194 /* Because of NaCl's use of segment registers, negative offsets from gs: will
197 * Because of NaCl's use of segment registers, negative offsets from gs: will 195 not work. Hence we need to make TLS references explicitly compute the
198 * not work. Hence we need to make TLS references explicitly compute the 196 tls base pointer and then indirect relative to it using the default
199 * tls base pointer and then indirect relative to it using the default 197 segment descriptor (DS). That is, instead of
200 * segment descriptor (DS). That is, instead of 198 movl gs:i@NTPOFF, %ecx
201 * movl gs:i@NTPOFF, %ecx 199 we use
202 * we use 200 movl %gs:0, %eax
203 * movl %gs:0, %eax 201 movl i@NTPOFF(%eax), %ecx
204 * movl i@NTPOFF(%eax), %ecx 202 There is a slight performance penalty for TLS accesses, but there does not
205 * There is a slight performance penalty for TLS accesses, but there does not 203 seem a way around it. */
206 * seem a way around it.
207 */
208 #undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 204 #undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT
209 #define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 0 205 #define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 0
210 206
211 /* TODO(pasko): eliminate the need to define linux-specific macros. Currently 207 /* TODO(pasko): eliminate the need to define linux-specific macros. Currently
212 * Chromium build/build_config.h prevents us from eliminating these defines by 208 Chromium build/build_config.h prevents us from eliminating these defines by
213 * not recognizing __native_client__ as a platform. */ 209 not recognizing __native_client__ as a platform. */
214 #define LINUX_TARGET_OS_CPP_BUILTINS() \ 210 #define LINUX_TARGET_OS_CPP_BUILTINS() \
215 do { \ 211 do { \
216 builtin_define_std ("unix"); \ 212 builtin_define_std ("unix"); \
217 builtin_assert ("system=unix"); \ 213 builtin_assert ("system=unix"); \
218 builtin_assert ("system=posix"); \ 214 builtin_assert ("system=posix"); \
219 } while (0) 215 } while (0)
220 216
217 /* When running in Native Client all inode numbers are identical.
218 TODO(pasko): re-enable inode numbers once the relevant bug is fixed:
219 http://code.google.com/p/nativeclient/issues/detail?id=1555 */
220 #ifdef __native_client__
221 #define HOST_LACKS_INODE_NUMBERS 1
222 #endif
223
221 #undef TARGET_OS_CPP_BUILTINS 224 #undef TARGET_OS_CPP_BUILTINS
222 #define TARGET_OS_CPP_BUILTINS() \ 225 #define TARGET_OS_CPP_BUILTINS() \
223 do \ 226 do \
224 { \ 227 { \
225 LINUX_TARGET_OS_CPP_BUILTINS(); \ 228 LINUX_TARGET_OS_CPP_BUILTINS(); \
226 builtin_define ("__native_client__=1"); \ 229 builtin_define ("__native_client__=1"); \
227 } \ 230 } \
228 while (0) 231 while (0)
229 232
230 /* NaCl uses are using ILP32 model even on x86-84. */ 233 /* NaCl uses are using ILP32 model even on x86-84. */
231 #undef LONG_TYPE_SIZE 234 #undef LONG_TYPE_SIZE
232 #define LONG_TYPE_SIZE 32 235 #define LONG_TYPE_SIZE 32
233 #define POINTER_SIZE 32 236 #define POINTER_SIZE 32
234 #define POINTERS_EXTEND_UNSIGNED 1 237 #define POINTERS_EXTEND_UNSIGNED 1
235 #undef LONG_DOUBLE_TYPE_SIZE 238 #undef LONG_DOUBLE_TYPE_SIZE
236 #define LONG_DOUBLE_TYPE_SIZE 64 239 #define LONG_DOUBLE_TYPE_SIZE 64
237 240
238 #undef TARGET_SUBTARGET_DEFAULT 241 #undef TARGET_SUBTARGET_DEFAULT
239 #define TARGET_SUBTARGET_DEFAULT (MASK_IEEE_FP) 242 #define TARGET_SUBTARGET_DEFAULT (MASK_IEEE_FP)
240 243
241 #undef TARGET_SUBTARGET32_DEFAULT 244 #undef TARGET_SUBTARGET32_DEFAULT
242 #define TARGET_SUBTARGET32_DEFAULT (MASK_80387 | MASK_ALIGN_DOUBLE | MASK_FLOAT_ RETURNS) 245 #define TARGET_SUBTARGET32_DEFAULT (MASK_80387 | MASK_ALIGN_DOUBLE | MASK_FLOAT_ RETURNS)
243 246
244 #undef TARGET_SUBTARGET64_DEFAULT 247 #undef TARGET_SUBTARGET64_DEFAULT
245 #define TARGET_SUBTARGET64_DEFAULT 0 248 #define TARGET_SUBTARGET64_DEFAULT 0
246 249
247 /* Configure script incorrectly detects this GAS capability on x86-64 and hence 250 /* Configure script incorrectly detects this GAS capability on x86-64 and hence
248 * forces JUMP_TABLES_IN_TEXT_SECTION which cannot validate in NaCl. */ 251 forces JUMP_TABLES_IN_TEXT_SECTION which cannot validate in NaCl. */
249 #undef HAVE_AS_GOTOFF_IN_DATA 252 #undef HAVE_AS_GOTOFF_IN_DATA
250 #define HAVE_AS_GOTOFF_IN_DATA 1 253 #define HAVE_AS_GOTOFF_IN_DATA 1
251 254
252 /* Configure script incorrectly detects HAVE_GAS_CFI_DIRECTIVE when readelf is 255 /* Configure script incorrectly detects HAVE_GAS_CFI_DIRECTIVE when readelf is
253 * not found in PATH. */ 256 not found in PATH. */
254 #undef HAVE_GAS_CFI_DIRECTIVE 257 #undef HAVE_GAS_CFI_DIRECTIVE
255 #define HAVE_GAS_CFI_DIRECTIVE 1 258 #define HAVE_GAS_CFI_DIRECTIVE 1
256 259
257 /* NaCl reserves R15 and makes RBP special in x86-64 mode */ 260 /* NaCl reserves R15 and makes RBP special in x86-64 mode. */
258 #undef FIXED_REGISTERS 261 #undef FIXED_REGISTERS
259 #define FIXED_REGISTERS \ 262 #define FIXED_REGISTERS \
260 /*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/ \ 263 /*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7*/ \
261 { 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, \ 264 { 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, \
262 /*arg,flags,fpsr,fpcr,frame*/ \ 265 /*arg,flags,fpsr,fpcr,frame*/ \
263 1, 1, 1, 1, 1, \ 266 1, 1, 1, 1, 1, \
264 /*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/ \ 267 /*xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7*/ \
265 0, 0, 0, 0, 0, 0, 0, 0, \ 268 0, 0, 0, 0, 0, 0, 0, 0, \
266 /* mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7*/ \ 269 /* mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7*/ \
267 0, 0, 0, 0, 0, 0, 0, 0, \ 270 0, 0, 0, 0, 0, 0, 0, 0, \
(...skipping 21 matching lines...) Expand all
289 #undef TARGET_USE_BT 292 #undef TARGET_USE_BT
290 #define TARGET_USE_BT (ix86_tune_features[X86_TUNE_USE_BT] && !TARGET_ NACL) 293 #define TARGET_USE_BT (ix86_tune_features[X86_TUNE_USE_BT] && !TARGET_ NACL)
291 294
292 #undef DBX_REGISTER_NUMBER 295 #undef DBX_REGISTER_NUMBER
293 #define DBX_REGISTER_NUMBER(n) \ 296 #define DBX_REGISTER_NUMBER(n) \
294 (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n]) 297 (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
295 298
296 #define DWARF2_ADDR_SIZE \ 299 #define DWARF2_ADDR_SIZE \
297 (TARGET_NACL ? (TARGET_64BIT ? 8 : 4) : \ 300 (TARGET_NACL ? (TARGET_64BIT ? 8 : 4) : \
298 (POINTER_SIZE / BITS_PER_UNIT)) 301 (POINTER_SIZE / BITS_PER_UNIT))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698