Chromium Code Reviews| 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 # These inputs are restated explicitly in the action. |
| 281 # linkers is 2M rather than the real Linux page | 278 # Stating them here is necessary for dependency checking. |
|
Evan Martin
2011/09/07 21:39:10
These comments might be unnecessary, your call. (
Brad Chen
2011/09/07 21:45:20
Done.
| |
| 282 # size of 4K. A larger page size is incompatible | 279 'inputs': [ |
| 283 # with our custom linker script's special layout. | 280 '<(linker_script)', |
| 284 '-Wl,-z,max-page-size=0x1000', | 281 '<(bootstrap_lib)', |
| 285 ], | 282 ], |
| 286 }, | 283 'outputs': [ |
| 284 '<(PRODUCT_DIR)/nacl_helper_bootstrap_raw', | |
| 285 ], | |
| 286 'message': 'Linking nacl_helper_bootstrap_raw', | |
| 287 'conditions': [ | |
| 288 ['target_arch=="x64"', { | |
| 289 'variables': { | |
| 290 'linker_emulation': 'elf_x86_64', | |
| 291 } | |
| 292 }], | |
| 293 ['target_arch=="ia32"', { | |
| 294 'variables': { | |
| 295 'linker_emulation': 'elf_i386', | |
| 296 } | |
| 297 }], | |
| 298 ['target_arch=="arm"', { | |
| 299 'variables': { | |
| 300 'linker_emulation': 'armelf_linux_eabi', | |
| 301 } | |
| 302 }], | |
| 303 ], | |
| 304 'action': ['../tools/ld_bfd/ld', | |
| 305 '-m', '<(linker_emulation)', | |
| 306 # This program is (almost) entirely standalone. It | |
| 307 # has its own startup code, so no crt1.o for it. It is | |
| 308 # statically linked, and on x86 it does not use | |
| 309 # libc at all. However, on ARM it needs a few (safe) | |
| 310 # things from libc. | |
| 311 '-static', | |
| 312 # Link with custom linker script for special layout. | |
| 313 '--script=<(linker_script)', | |
| 314 '-o', '<@(_outputs)', | |
| 315 # On x86-64, the default page size with some | |
| 316 # linkers is 2M rather than the real Linux page | |
| 317 # size of 4K. A larger page size is incompatible | |
| 318 # with our custom linker script's special layout. | |
| 319 '-z', 'max-page-size=0x1000', | |
| 320 '--whole-archive', '<(bootstrap_lib)', | |
| 321 '--no-whole-archive', | |
| 322 ], | |
| 323 } | |
| 324 ], | |
| 287 }, | 325 }, |
| 288 { | 326 { |
| 289 'target_name': 'nacl_helper_bootstrap', | 327 'target_name': 'nacl_helper_bootstrap', |
| 290 'dependencies': [ | 328 'dependencies': [ |
| 291 'nacl_helper_bootstrap_raw', | 329 'nacl_helper_bootstrap_raw', |
| 292 'nacl_helper_bootstrap_munge_phdr#host', | 330 'nacl_helper_bootstrap_munge_phdr#host', |
| 293 ], | 331 ], |
| 294 'type': 'none', | 332 'type': 'none', |
| 295 'actions': [{ | 333 'actions': [{ |
| 296 'action_name': 'munge_phdr', | 334 'action_name': 'munge_phdr', |
| 297 'inputs': ['nacl/nacl_helper_bootstrap_munge_phdr.py', | 335 'inputs': ['nacl/nacl_helper_bootstrap_munge_phdr.py', |
| 298 '<(PRODUCT_DIR)/nacl_helper_bootstrap_munge_phdr', | 336 '<(PRODUCT_DIR)/nacl_helper_bootstrap_munge_phdr', |
| 299 '<(PRODUCT_DIR)/nacl_helper_bootstrap_raw'], | 337 '<(PRODUCT_DIR)/nacl_helper_bootstrap_raw'], |
| 300 'outputs': ['<(PRODUCT_DIR)/nacl_helper_bootstrap'], | 338 'outputs': ['<(PRODUCT_DIR)/nacl_helper_bootstrap'], |
| 301 'message': 'Munging ELF program header', | 339 'message': 'Munging ELF program header', |
| 302 'action': ['python', '<@(_inputs)', '<@(_outputs)'] | 340 'action': ['python', '<@(_inputs)', '<@(_outputs)'] |
| 303 }], | 341 }], |
| 304 } | 342 }, |
| 305 ], | 343 ], |
| 306 }], | 344 }], |
| 307 ], | 345 ], |
| 308 } | 346 } |
| OLD | NEW |