Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: pnacl/driver/pnacl-ld.py

Issue 1825893002: PNaCl Dynamic Linking: Added portable dependencies to shared objects. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 from driver_tools import ArchMerge, DriverChain, GetArch, \ 6 from driver_tools import ArchMerge, DriverChain, GetArch, \
7 ParseArgs, ParseTriple, RunDriver, RunWithEnv, SetArch, \ 7 ParseArgs, ParseTriple, RunDriver, RunWithEnv, SetArch, \
8 SetExecutableMode, TempNameGen, UnrecognizedOption 8 SetExecutableMode, TempNameGen, UnrecognizedOption
9 from driver_env import env 9 from driver_env import env
10 from driver_log import Log 10 from driver_log import Log
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 inputs = ldtools.ExpandInputs(inputs, 338 inputs = ldtools.ExpandInputs(inputs,
339 env.get('SEARCH_DIRS'), 339 env.get('SEARCH_DIRS'),
340 env.getbool('STATIC'), 340 env.getbool('STATIC'),
341 # Once all glibc bitcode link is purely 341 # Once all glibc bitcode link is purely
342 # bitcode (e.g., even libc_nonshared.a) 342 # bitcode (e.g., even libc_nonshared.a)
343 # we may be able to restrict this more. 343 # we may be able to restrict this more.
344 # This is also currently used by 344 # This is also currently used by
345 # pnacl_generate_pexe=0 with glibc, 345 # pnacl_generate_pexe=0 with glibc,
346 # for user libraries. 346 # for user libraries.
347 ldtools.LibraryTypes.ANY) 347 ldtools.LibraryTypes.ANY)
348 (plls, inputs) = FilterPlls(inputs)
Mark Seaborn 2016/03/30 23:24:57 Nit: You don't need ()s around "plls, inputs" here
Sean Klein 2016/04/01 23:12:24 Done.
349
350 if not env.getbool('SHARED'):
351 assert(plls == [])
348 352
349 # Make sure the inputs have matching arch. 353 # Make sure the inputs have matching arch.
350 CheckInputsArch(inputs) 354 CheckInputsArch(inputs)
351 355
352 regular_inputs, native_objects = SplitLinkLine(inputs) 356 regular_inputs, native_objects = SplitLinkLine(inputs)
353 357
354 if env.getbool('RELOCATABLE'): 358 if env.getbool('RELOCATABLE'):
355 bitcode_type = 'po' 359 bitcode_type = 'po'
356 native_type = 'o' 360 native_type = 'o'
357 else: 361 else:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 pre_simplify_shared = [ 401 pre_simplify_shared = [
398 # The following is a subset of "-pnacl-abi-simplify-preopt". We don't 402 # The following is a subset of "-pnacl-abi-simplify-preopt". We don't
399 # want to run the full "-pnacl-abi-simplify-preopt" because it 403 # want to run the full "-pnacl-abi-simplify-preopt" because it
400 # internalizes symbols that we want to export via "-convert-to-pso". 404 # internalizes symbols that we want to export via "-convert-to-pso".
401 '-nacl-global-cleanup', 405 '-nacl-global-cleanup',
402 '-expand-varargs', 406 '-expand-varargs',
403 '-rewrite-pnacl-library-calls', 407 '-rewrite-pnacl-library-calls',
404 '-rewrite-llvm-intrinsic-calls', 408 '-rewrite-llvm-intrinsic-calls',
405 '-convert-to-pso', 409 '-convert-to-pso',
406 ] 410 ]
411
412 # ConvertToPso takes a list of comma-separated PLL dependencies as an
413 # argument.
414 if plls != []:
415 pre_simplify_shared += ['-deps=' + ','.join(plls)]
407 opt_args.append(pre_simplify_shared) 416 opt_args.append(pre_simplify_shared)
408 # Post-opt is required, since '-convert-to-pso' adds metadata which must 417 # Post-opt is required, since '-convert-to-pso' adds metadata which must
409 # be simplified before finalization. Additionally, all functions must be 418 # be simplified before finalization. Additionally, all functions must be
410 # simplified in the post-opt passes. 419 # simplified in the post-opt passes.
411 abi_simplify = True 420 abi_simplify = True
412 elif abi_simplify: 421 elif abi_simplify:
413 pre_simplify = ['-pnacl-abi-simplify-preopt'] 422 pre_simplify = ['-pnacl-abi-simplify-preopt']
414 if env.getone('CXX_EH_MODE') == 'sjlj': 423 if env.getone('CXX_EH_MODE') == 'sjlj':
415 pre_simplify += ['-enable-pnacl-sjlj-eh'] 424 pre_simplify += ['-enable-pnacl-sjlj-eh']
416 else: 425 else:
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 result_libs = [] 513 result_libs = []
505 for user_lib in user_libs: 514 for user_lib in user_libs:
506 if user_lib in public_libs: 515 if user_lib in public_libs:
507 result_libs.append(private_lib_for(user_lib)) 516 result_libs.append(private_lib_for(user_lib))
508 if can_coexist(user_lib): 517 if can_coexist(user_lib):
509 result_libs.append(user_lib) 518 result_libs.append(user_lib)
510 else: 519 else:
511 result_libs.append(user_lib) 520 result_libs.append(user_lib)
512 return result_libs 521 return result_libs
513 522
523 def FilterPlls(inputs):
524 """ Split the input list into PLLs and other objects (.pll, other)
525 """
526 pll = []
527 other = []
528
529 for f in inputs:
530 if ldtools.IsFlag(f):
531 other.append(f)
532 elif filetype.IsPll(f):
533 pll.append(f)
534 else:
535 other.append(f)
536 return (pll, other)
537
514 def SplitLinkLine(inputs): 538 def SplitLinkLine(inputs):
515 """ Split the input list into bitcode and native objects (.o, .a) 539 """ Split the input list into bitcode and native objects (.o, .a)
516 """ 540 """
517 normal = [] 541 normal = []
518 native = [] 542 native = []
519 # Group flags need special handling because they need to go into the right 543 # Group flags need special handling because they need to go into the right
520 # list based on the type of the inputs in the group. If the group has both 544 # list based on the type of the inputs in the group. If the group has both
521 # native and bitcode files (which is unfortunately the case for 545 # native and bitcode files (which is unfortunately the case for
522 # irt_browser_lib) then the group flags need to go in both lists. 546 # irt_browser_lib) then the group flags need to go in both lists.
523 if '--start-group' in inputs: 547 if '--start-group' in inputs:
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 -O<opt-level> Optimize output file 648 -O<opt-level> Optimize output file
625 -M, --print-map Print map file on standard output 649 -M, --print-map Print map file on standard output
626 --whole-archive Include all objects from following archives 650 --whole-archive Include all objects from following archives
627 --no-whole-archive Turn off --whole-archive 651 --no-whole-archive Turn off --whole-archive
628 -s, --strip-all Strip all symbols 652 -s, --strip-all Strip all symbols
629 -S, --strip-debug Strip debugging symbols 653 -S, --strip-debug Strip debugging symbols
630 -u SYM, --undefined=SYM Start with undefined reference to SYM 654 -u SYM, --undefined=SYM Start with undefined reference to SYM
631 655
632 -help | -h Output this help. 656 -help | -h Output this help.
633 """ 657 """
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698