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 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' ], | |
|
Mark Seaborn
2011/08/30 19:58:59
Style nit: use "[xx]" not "[ xx ]"
| |
| 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. | |
|
Mark Seaborn
2011/08/30 19:58:59
TODO(xx) is supposed to contain your name, not som
| |
| 231 'conditions': [ | |
| 232 ['host_arch=="x64"', { | |
| 233 'cflags/': [ ['exclude', '-m.*'] ], | |
|
Mark Seaborn
2011/08/30 19:58:59
Style nit: use "[xx]" not "[ xx ]"
| |
| 234 'ldflags/': [ ['exclude', '-m.*'] ], | |
| 235 }], | |
| 236 ], | |
| 237 }, | |
| 238 { | |
| 239 'target_name': 'nacl_helper_bootstrap_raw', | |
|
Mark Seaborn
2011/08/30 19:58:59
Maybe 'raw' -> 'before_patch' or something like th
| |
| 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. | |
|
Mark Seaborn
2011/08/30 19:58:59
Ditto about the TODO and bug raising.
| |
| 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. | |
|
Mark Seaborn
2011/08/30 19:58:59
Please add: ...because we are bypassing libc's ini
| |
| 255 '-fno-stack-protector', | |
| 256 # We don't want to compile it PIC (or its cousin PIE), because | |
| 257 # it goes at an absolute address anyway, and because any kind | |
| 258 # of PIC complicates life for the x86-32 assembly code. We | |
| 259 # append -fno-* flags here instead of using a 'cflags!' stanza | |
| 260 # to remove -f* flags, just in case some system's compiler | |
| 261 # defaults to using PIC for everything. | |
| 262 '-fno-pic', '-fno-PIC', | |
| 263 '-fno-pie', '-fno-PIE', | |
| 264 ], | |
| 265 'link_settings': { | |
| 266 'ldflags': [ | |
| 267 # TODO(bradchen): Delete the -B argument when Gold is verified | |
| 268 # to produce good results with our custom linker script. | |
| 269 # Until then use ld.bfd. | |
| 270 '-B', 'tools/ld_bfd', | |
| 271 # This programs is (almost) entirely standalone. It has | |
| 272 # its own startup code, so no crt1.o for it. It is | |
| 273 # statically linked, and on x86 it actually does not use | |
| 274 # libc at all. However, on ARM it needs a few (safe) | |
| 275 # things from libc, so we don't use '-nostdlib' here. | |
| 276 '-static', '-nostartfiles', | |
| 277 # Link with our custom linker script to get out special layout. | |
| 278 # TODO(bradnelson): Use some <(foo) instead of chrome/ here. | |
|
Mark Seaborn
2011/08/30 19:58:59
Ditto about TODOs
| |
| 279 '-Wl,--script=chrome/nacl/nacl_helper_bootstrap_linux.x', | |
| 280 # On x86-64, the default page size with some | |
| 281 # linkers is 2M rather than the real Linux page | |
| 282 # size of 4K. A larger page size is incompatible | |
| 283 # with our custom linker script's special layout. | |
| 284 '-Wl,-z,max-page-size=0x1000', | |
| 285 ], | |
| 211 }, | 286 }, |
| 212 }, | 287 }, |
| 213 { | 288 { |
| 214 'target_name': 'nacl_helper_bootstrap', | 289 'target_name': 'nacl_helper_bootstrap', |
| 215 'type': 'executable', | |
| 216 'dependencies': [ | 290 'dependencies': [ |
| 217 'nacl_helper.so', | 291 'nacl_helper_bootstrap_raw', |
| 218 ], | 292 'nacl_helper_bootstrap_munge_phdr#host', |
| 219 'sources': [ | 293 ], |
|
Mark Seaborn
2011/08/30 19:58:59
Indent -2 for consistency?
| |
| 220 '../chrome/nacl/nacl_helper_bootstrap_linux.c', | 294 'type': 'none', |
| 221 ], | 295 'actions': [{ |
| 222 # TODO(bradchen): Delete the -B argument when Gold supports | 296 'action_name': 'munge_phdr', |
| 223 # -Ttext properly. Until then use ld.bfd. | 297 'inputs': ['nacl/nacl_helper_bootstrap_munge_phdr.py', |
| 224 'link_settings': { | 298 '<(PRODUCT_DIR)/nacl_helper_bootstrap_munge_phdr', |
| 225 'ldflags': ['-B', 'tools/ld_bfd', | 299 '<(PRODUCT_DIR)/nacl_helper_bootstrap_raw'], |
| 226 # Force text segment at 0x10000 (64KB) | 300 'outputs': ['<(PRODUCT_DIR)/nacl_helper_bootstrap'], |
| 227 # The max-page-size option is needed on x86-64 linux | 301 'message': 'Munging ELF program header', |
| 228 # where 4K pages are not the default in the BFD linker. | 302 'action': ['python', '<@(_inputs)', '<@(_outputs)'] |
| 229 '-Wl,-Ttext-segment,10000,-z,max-page-size=0x1000', | 303 }], |
| 230 # reference nacl_helper as a shared library | 304 } |
| 231 '<(PRODUCT_DIR)/nacl_helper.so', | |
| 232 '-Wl,-rpath,<(SHARED_LIB_DIR)', | |
| 233 ], | |
| 234 }, | |
| 235 }, | |
| 236 ], | 305 ], |
| 237 }], | 306 }], |
| 238 ], | 307 ], |
| 239 } | 308 } |
| OLD | NEW |