| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 176               'NACL_BLOCK_SIZE=32', | 176               'NACL_BLOCK_SIZE=32', | 
| 177               '<@(nacl_defines)', | 177               '<@(nacl_defines)', | 
| 178             ], | 178             ], | 
| 179           }, | 179           }, | 
| 180         }, | 180         }, | 
| 181       ], | 181       ], | 
| 182     }], | 182     }], | 
| 183     ['OS=="linux"', { | 183     ['OS=="linux"', { | 
| 184       'targets': [ | 184       'targets': [ | 
| 185         { | 185         { | 
| 186           'target_name': 'nacl_helper.so', | 186           'target_name': 'nacl_helper', | 
| 187           # 'executable' will be overridden below when we add the -shared |  | 
| 188           # flag; here it prevents gyp from using the --whole-archive flag |  | 
| 189           'type': 'executable', | 187           'type': 'executable', | 
| 190           'include_dirs': [ | 188           'include_dirs': [ | 
| 191             '..', | 189             '..', | 
| 192           ], | 190           ], | 
| 193           'dependencies': [ | 191           'dependencies': [ | 
| 194             'nacl', | 192             'nacl', | 
| 195           ], | 193           ], | 
| 196           'sources': [ | 194           'sources': [ | 
| 197             '../chrome/nacl/nacl_helper_linux.cc', | 195             'nacl/nacl_helper_linux.cc', | 
| 198           ], | 196           ], | 
| 199           'conditions': [ | 197           'conditions': [ | 
| 200             ['toolkit_uses_gtk == 1', { | 198             ['toolkit_uses_gtk == 1', { | 
| 201               'dependencies': [ | 199               'dependencies': [ | 
| 202                 '../build/linux/system.gyp:gtk', | 200                 '../build/linux/system.gyp:gtk', | 
| 203               ], | 201               ], | 
| 204             }], | 202             }], | 
| 205           ], | 203           ], | 
|  | 204           'cflags': ['-fPIE'], | 
| 206           'link_settings': { | 205           'link_settings': { | 
| 207             # NOTE: '-shared' overrides 'executable' above | 206             'ldflags': ['-pie'], | 
| 208             'ldflags': ['-shared', | 207           }, | 
| 209                         '-Wl,--version-script=chrome/nacl/nacl_helper_exports.tx
     t', | 208         }, | 
| 210                       ], | 209         { | 
|  | 210           'target_name': 'nacl_helper_bootstrap_munge_phdr', | 
|  | 211           'type': 'executable', | 
|  | 212           'toolsets': ['host'], | 
|  | 213           'sources': [ | 
|  | 214             'nacl/nacl_helper_bootstrap_munge_phdr.c', | 
|  | 215           ], | 
|  | 216           'libraries': [ | 
|  | 217             '-lelf', | 
|  | 218           ], | 
|  | 219           # This is an ugly kludge because gyp doesn't actually treat | 
|  | 220           # host_arch=x64 target_arch=ia32 as proper cross compilation. | 
|  | 221           # It still wants to compile the "host" program with -m32 et | 
|  | 222           # al.  Though a program built that way can indeed run on the | 
|  | 223           # x86-64 host, we cannot reliably build this program on such a | 
|  | 224           # host because Ubuntu does not provide the full suite of | 
|  | 225           # x86-32 libraries in packages that can be installed on an | 
|  | 226           # x86-64 host; in particular, libelf is missing.  So here we | 
|  | 227           # use the hack of eliding all the -m* flags from the | 
|  | 228           # compilation lines, getting the command close to what they | 
|  | 229           # would be if gyp were to really build properly for the host. | 
|  | 230           # TODO(bradnelson): Clean up with proper cross support. | 
|  | 231           'conditions': [ | 
|  | 232             ['host_arch=="x64"', { | 
|  | 233               'cflags/': [['exclude', '-m.*']], | 
|  | 234               'ldflags/': [['exclude', '-m.*']], | 
|  | 235             }], | 
|  | 236           ], | 
|  | 237         }, | 
|  | 238         { | 
|  | 239           'target_name': 'nacl_helper_bootstrap_raw', | 
|  | 240           'type': 'executable', | 
|  | 241           'include_dirs': [ | 
|  | 242             '..', | 
|  | 243           ], | 
|  | 244           'sources': [ | 
|  | 245             '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           ], | 
|  | 252           'cflags': [ | 
|  | 253             # The tiny standalone bootstrap program is incompatible with | 
|  | 254             # -fstack-protector, which might be on by default.  That switch | 
|  | 255             # requires using the standard libc startup code, which we do not. | 
|  | 256             '-fno-stack-protector', | 
|  | 257             # 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 | 
|  | 259             # of PIC complicates life for the x86-32 assembly code.  We | 
|  | 260             # append -fno-* flags here instead of using a 'cflags!' stanza | 
|  | 261             # to remove -f* flags, just in case some system's compiler | 
|  | 262             # defaults to using PIC for everything. | 
|  | 263             '-fno-pic', '-fno-PIC', | 
|  | 264             '-fno-pie', '-fno-PIE', | 
|  | 265           ], | 
|  | 266           'link_settings': { | 
|  | 267             'ldflags': [ | 
|  | 268               # TODO(bradchen): Delete the -B argument when Gold is verified | 
|  | 269               # to produce good results with our custom linker script. | 
|  | 270               # Until then use ld.bfd. | 
|  | 271               '-B', 'tools/ld_bfd', | 
|  | 272               # This programs is (almost) entirely standalone.  It has | 
|  | 273               # its own startup code, so no crt1.o for it.  It is | 
|  | 274               # statically linked, and on x86 it actually does not use | 
|  | 275               # libc at all.  However, on ARM it needs a few (safe) | 
|  | 276               # things from libc, so we don't use '-nostdlib' here. | 
|  | 277               '-static', '-nostartfiles', | 
|  | 278               # Link with our custom linker script to get out special layout. | 
|  | 279               # TODO(bradnelson): Use some <(foo) instead of chrome/ here. | 
|  | 280               '-Wl,--script=chrome/nacl/nacl_helper_bootstrap_linux.x', | 
|  | 281               # On x86-64, the default page size with some | 
|  | 282               # linkers is 2M rather than the real Linux page | 
|  | 283               # size of 4K.  A larger page size is incompatible | 
|  | 284               # with our custom linker script's special layout. | 
|  | 285               '-Wl,-z,max-page-size=0x1000', | 
|  | 286             ], | 
| 211           }, | 287           }, | 
| 212         }, | 288         }, | 
| 213         { | 289         { | 
| 214           'target_name': 'nacl_helper_bootstrap', | 290           'target_name': 'nacl_helper_bootstrap', | 
| 215           'type': 'executable', |  | 
| 216           'dependencies': [ | 291           'dependencies': [ | 
| 217             'nacl_helper.so', | 292             'nacl_helper_bootstrap_raw', | 
|  | 293             'nacl_helper_bootstrap_munge_phdr#host', | 
| 218           ], | 294           ], | 
| 219           'sources': [ | 295           'type': 'none', | 
| 220             '../chrome/nacl/nacl_helper_bootstrap_linux.c', | 296           'actions': [{ | 
| 221           ], | 297               'action_name': 'munge_phdr', | 
| 222           # TODO(bradchen): Delete the -B argument when Gold supports | 298               'inputs': ['nacl/nacl_helper_bootstrap_munge_phdr.py', | 
| 223           # -Ttext properly. Until then use ld.bfd. | 299                          '<(PRODUCT_DIR)/nacl_helper_bootstrap_munge_phdr', | 
| 224           'link_settings': { | 300                          '<(PRODUCT_DIR)/nacl_helper_bootstrap_raw'], | 
| 225             'ldflags': ['-B', 'tools/ld_bfd', | 301               'outputs': ['<(PRODUCT_DIR)/nacl_helper_bootstrap'], | 
| 226                         # Force text segment at 0x10000 (64KB) | 302               'message': 'Munging ELF program header', | 
| 227                         # The max-page-size option is needed on x86-64 linux | 303               'action': ['python', '<@(_inputs)', '<@(_outputs)'] | 
| 228                         # where 4K pages are not the default in the BFD linker. | 304             }], | 
| 229                         '-Wl,-Ttext-segment,10000,-z,max-page-size=0x1000', | 305           } | 
| 230                         # reference nacl_helper as a shared library |  | 
| 231                         '<(PRODUCT_DIR)/nacl_helper.so', |  | 
| 232                         '-Wl,-rpath,<(SHARED_LIB_DIR)', |  | 
| 233                       ], |  | 
| 234           }, |  | 
| 235         }, |  | 
| 236       ], | 306       ], | 
| 237     }], | 307     }], | 
| 238   ], | 308   ], | 
| 239 } | 309 } | 
| OLD | NEW | 
|---|