OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 { | 5 { |
6 'include': [ | 6 'include': [ |
7 '../native_client/build/untrusted.gypi', | 7 '../native_client/build/untrusted.gypi', |
8 ], | 8 ], |
9 'target_defaults': { | 9 'target_defaults': { |
10 'variables': { | 10 'variables': { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 ], | 180 ], |
181 }], | 181 }], |
182 ], | 182 ], |
183 }], | 183 }], |
184 ], | 184 ], |
185 'cflags': ['-fPIE'], | 185 'cflags': ['-fPIE'], |
186 'link_settings': { | 186 'link_settings': { |
187 'ldflags': ['-pie'], | 187 'ldflags': ['-pie'], |
188 }, | 188 }, |
189 }, | 189 }, |
190 { | |
191 'target_name': 'nacl_helper_bootstrap_munge_phdr', | |
192 'type': 'executable', | |
193 'toolsets': ['host'], | |
194 'sources': [ | |
195 'nacl/nacl_helper_bootstrap_munge_phdr.c', | |
196 ], | |
197 'libraries': [ | |
198 '-lelf', | |
199 ], | |
200 # This is an ugly kludge because gyp doesn't actually treat | |
201 # host_arch=x64 target_arch=ia32 as proper cross compilation. | |
202 # It still wants to compile the "host" program with -m32 et | |
203 # al. Though a program built that way can indeed run on the | |
204 # x86-64 host, we cannot reliably build this program on such a | |
205 # host because Ubuntu does not provide the full suite of | |
206 # x86-32 libraries in packages that can be installed on an | |
207 # x86-64 host; in particular, libelf is missing. So here we | |
208 # use the hack of eliding all the -m* flags from the | |
209 # compilation lines, getting the command close to what they | |
210 # would be if gyp were to really build properly for the host. | |
211 # TODO(bradnelson): Clean up with proper cross support. | |
212 'conditions': [ | |
213 ['host_arch=="x64"', { | |
214 'cflags/': [['exclude', '-m.*']], | |
215 'ldflags/': [['exclude', '-m.*']], | |
216 }], | |
217 ], | |
218 }, | |
219 { | |
220 'target_name': 'nacl_helper_bootstrap_lib', | |
221 'type': 'static_library', | |
222 'product_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', | |
223 'hard_depencency': 1, | |
224 'include_dirs': [ | |
225 '..', | |
226 ], | |
227 'sources': [ | |
228 'nacl/nacl_helper_bootstrap_linux.c', | |
229 ], | |
230 'cflags': [ | |
231 # The tiny standalone bootstrap program is incompatible with | |
232 # -fstack-protector, which might be on by default. That switch | |
233 # requires using the standard libc startup code, which we do not
. | |
234 '-fno-stack-protector', | |
235 # We don't want to compile it PIC (or its cousin PIE), because | |
236 # it goes at an absolute address anyway, and because any kind | |
237 # of PIC complicates life for the x86-32 assembly code. We | |
238 # append -fno-* flags here instead of using a 'cflags!' stanza | |
239 # to remove -f* flags, just in case some system's compiler | |
240 # defaults to using PIC for everything. | |
241 '-fno-pic', '-fno-PIC', | |
242 '-fno-pie', '-fno-PIE', | |
243 ], | |
244 'cflags!': [ | |
245 # TODO(glider): -fasan is deprecated. | |
246 '-fasan', | |
247 '-faddress-sanitizer', | |
248 '-w', | |
249 ], | |
250 'conditions': [ | |
251 ['clang==1', { | |
252 'cflags': [ | |
253 # Prevent llvm-opt from replacing my_bzero with a call | |
254 # to memset | |
255 '-ffreestanding', | |
256 # But make its <limits.h> still work! | |
257 '-U__STDC_HOSTED__', '-D__STDC_HOSTED__=1', | |
258 ], | |
259 }], | |
260 ], | |
261 }, | |
262 { | |
263 'target_name': 'nacl_helper_bootstrap_raw', | |
264 'type': 'none', | |
265 'dependencies': [ | |
266 'nacl_helper_bootstrap_lib', | |
267 ], | |
268 'actions': [ | |
269 { | |
270 'action_name': 'link_with_ld_bfd', | |
271 'variables': { | |
272 'bootstrap_lib': '<(SHARED_INTERMEDIATE_DIR)/chrome/<(STATIC
_LIB_PREFIX)nacl_helper_bootstrap_lib<(STATIC_LIB_SUFFIX)', | |
273 'linker_script': 'nacl/nacl_helper_bootstrap_linux.x', | |
274 }, | |
275 'inputs': [ | |
276 '<(linker_script)', | |
277 '<(bootstrap_lib)', | |
278 '../tools/ld_bfd/ld', | |
279 ], | |
280 'outputs': [ | |
281 '<(PRODUCT_DIR)/nacl_helper_bootstrap_raw', | |
282 ], | |
283 'message': 'Linking nacl_helper_bootstrap_raw', | |
284 'conditions': [ | |
285 ['target_arch=="x64"', { | |
286 'variables': { | |
287 'linker_emulation': 'elf_x86_64', | |
288 'bootstrap_extra_lib': '', | |
289 } | |
290 }], | |
291 ['target_arch=="ia32"', { | |
292 'variables': { | |
293 'linker_emulation': 'elf_i386', | |
294 'bootstrap_extra_lib': '', | |
295 } | |
296 }], | |
297 ['target_arch=="arm"', { | |
298 'variables': { | |
299 'linker_emulation': 'armelf_linux_eabi', | |
300 # ARM requires linking against libc due to ABI | |
301 # dependencies on memset. | |
302 'bootstrap_extra_lib' : "${SYSROOT}/usr/lib/libc.a", | |
303 } | |
304 }], | |
305 ], | |
306 'action': ['../tools/ld_bfd/ld', | |
307 '-m', '<(linker_emulation)', | |
308 '--build-id', | |
309 # This program is (almost) entirely | |
310 # standalone. It has its own startup code, so | |
311 # no crt1.o for it. It is statically linked, | |
312 # and on x86 it does not use libc at all. | |
313 # However, on ARM it needs a few (safe) things | |
314 # from libc. | |
315 '-static', | |
316 # Link with custom linker script for special | |
317 # layout. The script uses the symbol RESERVE_TOP. | |
318 '<@(nacl_reserve_top)', | |
319 '--script=<(linker_script)', | |
320 '-o', '<@(_outputs)', | |
321 # On x86-64, the default page size with some | |
322 # linkers is 2M rather than the real Linux page | |
323 # size of 4K. A larger page size is incompatible | |
324 # with our custom linker script's special layout. | |
325 '-z', 'max-page-size=0x1000', | |
326 '--whole-archive', '<(bootstrap_lib)', | |
327 '--no-whole-archive', | |
328 '<@(bootstrap_extra_lib)', | |
329 ], | |
330 } | |
331 ], | |
332 }, | |
333 { | |
334 'target_name': 'nacl_helper_bootstrap', | |
335 'dependencies': [ | |
336 'nacl_helper_bootstrap_raw', | |
337 'nacl_helper_bootstrap_munge_phdr#host', | |
338 ], | |
339 'type': 'none', | |
340 'actions': [{ | |
341 'action_name': 'munge_phdr', | |
342 'inputs': ['nacl/nacl_helper_bootstrap_munge_phdr.py', | |
343 '<(PRODUCT_DIR)/nacl_helper_bootstrap_munge_phdr', | |
344 '<(PRODUCT_DIR)/nacl_helper_bootstrap_raw'], | |
345 'outputs': ['<(PRODUCT_DIR)/nacl_helper_bootstrap'], | |
346 'message': 'Munging ELF program header', | |
347 'action': ['python', '<@(_inputs)', '<@(_outputs)'] | |
348 }], | |
349 }, | |
350 ], | 190 ], |
351 }], | 191 }], |
352 ], | 192 ], |
353 }, { # else (disable_nacl==1) | 193 }, { # else (disable_nacl==1) |
354 'targets': [ | 194 'targets': [ |
355 { | 195 { |
356 'target_name': 'nacl', | 196 'target_name': 'nacl', |
357 'type': 'none', | 197 'type': 'none', |
358 'sources': [], | 198 'sources': [], |
359 }, | 199 }, |
360 ], | 200 ], |
361 'conditions': [ | 201 'conditions': [ |
362 ['OS=="win"', { | 202 ['OS=="win"', { |
363 'targets': [ | 203 'targets': [ |
364 { | 204 { |
365 'target_name': 'nacl_win64', | 205 'target_name': 'nacl_win64', |
366 'type': 'none', | 206 'type': 'none', |
367 'sources': [], | 207 'sources': [], |
368 }, | 208 }, |
369 ], | 209 ], |
370 }], | 210 }], |
371 ], | 211 ], |
372 }], | 212 }], |
373 ], | 213 ], |
374 } | 214 } |
OLD | NEW |