| 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 'target_defaults': { | 6 'target_defaults': { |
| 7 'variables': { | 7 'variables': { |
| 8 'nacl_target': 0, | 8 'nacl_target': 0, |
| 9 }, | 9 }, |
| 10 'target_conditions': [ | 10 'target_conditions': [ |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 # would be if gyp were to really build properly for the host. | 229 # would be if gyp were to really build properly for the host. |
| 230 # TODO(bradnelson): Clean up with proper cross support. | 230 # TODO(bradnelson): Clean up with proper cross support. |
| 231 'conditions': [ | 231 'conditions': [ |
| 232 ['host_arch=="x64"', { | 232 ['host_arch=="x64"', { |
| 233 'cflags/': [['exclude', '-m.*']], | 233 'cflags/': [['exclude', '-m.*']], |
| 234 'ldflags/': [['exclude', '-m.*']], | 234 'ldflags/': [['exclude', '-m.*']], |
| 235 }], | 235 }], |
| 236 ], | 236 ], |
| 237 }, | 237 }, |
| 238 { | 238 { |
| 239 'target_name': 'nacl_helper_bootstrap_raw', | 239 'target_name': 'nacl_helper_bootstrap_lib', |
| 240 'type': 'executable', | 240 'type': 'static_library', |
| 241 'product_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', |
| 242 'hard_depencency': 1, |
| 241 'include_dirs': [ | 243 'include_dirs': [ |
| 242 '..', | 244 '..', |
| 243 ], | 245 ], |
| 244 'sources': [ | 246 'sources': [ |
| 245 'nacl/nacl_helper_bootstrap_linux.c', | 247 'nacl/nacl_helper_bootstrap_linux.c', |
| 246 # We list the linker script here for documentation purposes. | |
| 247 # But even this doesn't make gyp treat it as a dependency, | |
| 248 # so incremental builds won't relink when the script changes. | |
| 249 # TODO(bradnelson): Fix the dependency handling. | |
| 250 'nacl/nacl_helper_bootstrap_linux.x', | |
| 251 ], | 248 ], |
| 252 'cflags': [ | 249 'cflags': [ |
| 253 # The tiny standalone bootstrap program is incompatible with | 250 # The tiny standalone bootstrap program is incompatible with |
| 254 # -fstack-protector, which might be on by default. That switch | 251 # -fstack-protector, which might be on by default. That switch |
| 255 # requires using the standard libc startup code, which we do not. | 252 # requires using the standard libc startup code, which we do not. |
| 256 '-fno-stack-protector', | 253 '-fno-stack-protector', |
| 257 # We don't want to compile it PIC (or its cousin PIE), because | 254 # We don't want to compile it PIC (or its cousin PIE), because |
| 258 # it goes at an absolute address anyway, and because any kind | 255 # it goes at an absolute address anyway, and because any kind |
| 259 # of PIC complicates life for the x86-32 assembly code. We | 256 # of PIC complicates life for the x86-32 assembly code. We |
| 260 # append -fno-* flags here instead of using a 'cflags!' stanza | 257 # append -fno-* flags here instead of using a 'cflags!' stanza |
| 261 # to remove -f* flags, just in case some system's compiler | 258 # to remove -f* flags, just in case some system's compiler |
| 262 # defaults to using PIC for everything. | 259 # defaults to using PIC for everything. |
| 263 '-fno-pic', '-fno-PIC', | 260 '-fno-pic', '-fno-PIC', |
| 264 '-fno-pie', '-fno-PIE', | 261 '-fno-pie', '-fno-PIE', |
| 265 ], | 262 ], |
| 266 'link_settings': { | 263 }, |
| 267 'ldflags': [ | 264 { |
| 268 # TODO(bradchen): Delete the -B argument when Gold is verified | 265 'target_name': 'nacl_helper_bootstrap_raw', |
| 269 # to produce good results with our custom linker script. | 266 'type': 'none', |
| 270 # Until then use ld.bfd. | 267 'dependencies': [ |
| 271 '-B', '<(PRODUCT_DIR)/../../tools/ld_bfd', | 268 'nacl_helper_bootstrap_lib', |
| 272 # This programs is (almost) entirely standalone. It has | 269 ], |
| 273 # its own startup code, so no crt1.o for it. It is | 270 'actions': [ |
| 274 # statically linked, and on x86 it actually does not use | 271 { |
| 275 # libc at all. However, on ARM it needs a few (safe) | 272 'action_name': 'link_with_ld_bfd', |
| 276 # things from libc, so we don't use '-nostdlib' here. | 273 'variables': { |
| 277 '-static', '-nostartfiles', | 274 'bootstrap_lib': '<(SHARED_INTERMEDIATE_DIR)/chrome/<(STATIC_LIB
_PREFIX)nacl_helper_bootstrap_lib<(STATIC_LIB_SUFFIX)', |
| 278 # Link with our custom linker script to get out special layout. | 275 'linker_script': 'nacl/nacl_helper_bootstrap_linux.x', |
| 279 '-Wl,--script=<(PRODUCT_DIR)/../../chrome/nacl/nacl_helper_bootstr
ap_linux.x', | 276 }, |
| 280 # On x86-64, the default page size with some | 277 'inputs': [ |
| 281 # linkers is 2M rather than the real Linux page | 278 '<(linker_script)', |
| 282 # size of 4K. A larger page size is incompatible | 279 '<(bootstrap_lib)', |
| 283 # with our custom linker script's special layout. | 280 '../tools/ld_bfd/ld', |
| 284 '-Wl,-z,max-page-size=0x1000', | 281 ], |
| 285 ], | 282 'outputs': [ |
| 286 }, | 283 '<(PRODUCT_DIR)/nacl_helper_bootstrap_raw', |
| 284 ], |
| 285 'message': 'Linking nacl_helper_bootstrap_raw', |
| 286 'conditions': [ |
| 287 ['target_arch=="x64"', { |
| 288 'variables': { |
| 289 'linker_emulation': 'elf_x86_64', |
| 290 } |
| 291 }], |
| 292 ['target_arch=="ia32"', { |
| 293 'variables': { |
| 294 'linker_emulation': 'elf_i386', |
| 295 } |
| 296 }], |
| 297 ['target_arch=="arm"', { |
| 298 'variables': { |
| 299 'linker_emulation': 'armelf_linux_eabi', |
| 300 } |
| 301 }], |
| 302 ], |
| 303 'action': ['../tools/ld_bfd/ld', |
| 304 '-m', '<(linker_emulation)', |
| 305 # This program is (almost) entirely standalone. It |
| 306 # has its own startup code, so no crt1.o for it. It is |
| 307 # statically linked, and on x86 it does not use |
| 308 # libc at all. However, on ARM it needs a few (safe) |
| 309 # things from libc. |
| 310 '-static', |
| 311 # Link with custom linker script for special layout. |
| 312 '--script=<(linker_script)', |
| 313 '-o', '<@(_outputs)', |
| 314 # On x86-64, the default page size with some |
| 315 # linkers is 2M rather than the real Linux page |
| 316 # size of 4K. A larger page size is incompatible |
| 317 # with our custom linker script's special layout. |
| 318 '-z', 'max-page-size=0x1000', |
| 319 '--whole-archive', '<(bootstrap_lib)', |
| 320 '--no-whole-archive', |
| 321 ], |
| 322 } |
| 323 ], |
| 287 }, | 324 }, |
| 288 { | 325 { |
| 289 'target_name': 'nacl_helper_bootstrap', | 326 'target_name': 'nacl_helper_bootstrap', |
| 290 'dependencies': [ | 327 'dependencies': [ |
| 291 'nacl_helper_bootstrap_raw', | 328 'nacl_helper_bootstrap_raw', |
| 292 'nacl_helper_bootstrap_munge_phdr#host', | 329 'nacl_helper_bootstrap_munge_phdr#host', |
| 293 ], | 330 ], |
| 294 'type': 'none', | 331 'type': 'none', |
| 295 'actions': [{ | 332 'actions': [{ |
| 296 'action_name': 'munge_phdr', | 333 'action_name': 'munge_phdr', |
| 297 'inputs': ['nacl/nacl_helper_bootstrap_munge_phdr.py', | 334 'inputs': ['nacl/nacl_helper_bootstrap_munge_phdr.py', |
| 298 '<(PRODUCT_DIR)/nacl_helper_bootstrap_munge_phdr', | 335 '<(PRODUCT_DIR)/nacl_helper_bootstrap_munge_phdr', |
| 299 '<(PRODUCT_DIR)/nacl_helper_bootstrap_raw'], | 336 '<(PRODUCT_DIR)/nacl_helper_bootstrap_raw'], |
| 300 'outputs': ['<(PRODUCT_DIR)/nacl_helper_bootstrap'], | 337 'outputs': ['<(PRODUCT_DIR)/nacl_helper_bootstrap'], |
| 301 'message': 'Munging ELF program header', | 338 'message': 'Munging ELF program header', |
| 302 'action': ['python', '<@(_inputs)', '<@(_outputs)'] | 339 'action': ['python', '<@(_inputs)', '<@(_outputs)'] |
| 303 }], | 340 }], |
| 304 } | 341 }, |
| 305 ], | 342 ], |
| 306 }], | 343 }], |
| 307 ], | 344 ], |
| 308 } | 345 } |
| OLD | NEW |