| Index: build/toolchain/gcc_solink_wrapper.py
|
| diff --git a/build/toolchain/gcc_solink_wrapper.py b/build/toolchain/gcc_solink_wrapper.py
|
| index 426f9d66332ca34b755d112e4070864b0e4a0a7d..79363f91a1c10389abc0845daf73effe2165e11d 100755
|
| --- a/build/toolchain/gcc_solink_wrapper.py
|
| +++ b/build/toolchain/gcc_solink_wrapper.py
|
| @@ -12,17 +12,31 @@
|
|
|
| import argparse
|
| import os
|
| +import re
|
| import subprocess
|
| import sys
|
|
|
| -import wrapper_utils
|
| +
|
| +# When running on a Windows host and using a toolchain whose tools are
|
| +# actually wrapper scripts (i.e. .bat files on Windows) rather than binary
|
| +# executables, the "command" to run has to be prefixed with this magic.
|
| +# The GN toolchain definitions take care of that for when GN/Ninja is
|
| +# running the tool directly. When that command is passed in to this
|
| +# script, it appears as a unitary string but needs to be split up so that
|
| +# just 'cmd' is the actual command given to Python's subprocess module.
|
| +BAT_PREFIX = 'cmd /c call '
|
| +
|
| +def CommandToRun(command):
|
| + if command[0].startswith(BAT_PREFIX):
|
| + command = command[0].split(None, 3) + command[1:]
|
| + return command
|
|
|
|
|
| def CollectSONAME(args):
|
| """Replaces: readelf -d $sofile | grep SONAME"""
|
| toc = ''
|
| - readelf = subprocess.Popen(wrapper_utils.CommandToRun(
|
| - [args.readelf, '-d', args.sofile]), stdout=subprocess.PIPE, bufsize=-1)
|
| + readelf = subprocess.Popen(CommandToRun([args.readelf, '-d', args.sofile]),
|
| + stdout=subprocess.PIPE, bufsize=-1)
|
| for line in readelf.stdout:
|
| if 'SONAME' in line:
|
| toc += line
|
| @@ -32,7 +46,7 @@
|
| def CollectDynSym(args):
|
| """Replaces: nm --format=posix -g -D $sofile | cut -f1-2 -d' '"""
|
| toc = ''
|
| - nm = subprocess.Popen(wrapper_utils.CommandToRun([
|
| + nm = subprocess.Popen(CommandToRun([
|
| args.nm, '--format=posix', '-g', '-D', args.sofile]),
|
| stdout=subprocess.PIPE, bufsize=-1)
|
| for line in nm.stdout:
|
| @@ -82,9 +96,6 @@
|
| required=True,
|
| help='Final output shared object file',
|
| metavar='FILE')
|
| - parser.add_argument('--resource-whitelist',
|
| - help='Merge all resource whitelists into a single file.',
|
| - metavar='PATH')
|
| parser.add_argument('command', nargs='+',
|
| help='Linking command')
|
| args = parser.parse_args()
|
| @@ -93,14 +104,8 @@
|
| fast_env = dict(os.environ)
|
| fast_env['LC_ALL'] = 'C'
|
|
|
| - if args.resource_whitelist:
|
| - whitelist_candidates = wrapper_utils.ResolveRspLinks(args.command)
|
| - wrapper_utils.CombineResourceWhitelists(
|
| - whitelist_candidates, args.resource_whitelist)
|
| -
|
| # First, run the actual link.
|
| - result = subprocess.call(
|
| - wrapper_utils.CommandToRun(args.command), env=fast_env)
|
| + result = subprocess.call(CommandToRun(args.command), env=fast_env)
|
| if result != 0:
|
| return result
|
|
|
| @@ -115,8 +120,8 @@
|
|
|
| # Finally, strip the linked shared object file (if desired).
|
| if args.strip:
|
| - result = subprocess.call(wrapper_utils.CommandToRun(
|
| - [args.strip, '--strip-unneeded', '-o', args.output, args.sofile]))
|
| + result = subprocess.call(CommandToRun([args.strip, '--strip-unneeded',
|
| + '-o', args.output, args.sofile]))
|
|
|
| return result
|
|
|
|
|