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

Unified Diff: build/toolchain/gcc_solink_wrapper.py

Issue 2175413004: Enable whitelist generation for all builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + change output dir Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/toolchain/gcc_compile_wrapper.py ('k') | build/toolchain/gcc_toolchain.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/toolchain/gcc_solink_wrapper.py
diff --git a/build/toolchain/gcc_solink_wrapper.py b/build/toolchain/gcc_solink_wrapper.py
index 79363f91a1c10389abc0845daf73effe2165e11d..426f9d66332ca34b755d112e4070864b0e4a0a7d 100755
--- a/build/toolchain/gcc_solink_wrapper.py
+++ b/build/toolchain/gcc_solink_wrapper.py
@@ -12,31 +12,17 @@ does not have a POSIX-like shell (e.g. Windows).
import argparse
import os
-import re
import subprocess
import sys
-
-# 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
+import wrapper_utils
def CollectSONAME(args):
"""Replaces: readelf -d $sofile | grep SONAME"""
toc = ''
- readelf = subprocess.Popen(CommandToRun([args.readelf, '-d', args.sofile]),
- stdout=subprocess.PIPE, bufsize=-1)
+ readelf = subprocess.Popen(wrapper_utils.CommandToRun(
+ [args.readelf, '-d', args.sofile]), stdout=subprocess.PIPE, bufsize=-1)
for line in readelf.stdout:
if 'SONAME' in line:
toc += line
@@ -46,7 +32,7 @@ def CollectSONAME(args):
def CollectDynSym(args):
"""Replaces: nm --format=posix -g -D $sofile | cut -f1-2 -d' '"""
toc = ''
- nm = subprocess.Popen(CommandToRun([
+ nm = subprocess.Popen(wrapper_utils.CommandToRun([
args.nm, '--format=posix', '-g', '-D', args.sofile]),
stdout=subprocess.PIPE, bufsize=-1)
for line in nm.stdout:
@@ -96,6 +82,9 @@ def main():
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()
@@ -104,8 +93,14 @@ def main():
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(CommandToRun(args.command), env=fast_env)
+ result = subprocess.call(
+ wrapper_utils.CommandToRun(args.command), env=fast_env)
if result != 0:
return result
@@ -120,8 +115,8 @@ def main():
# Finally, strip the linked shared object file (if desired).
if args.strip:
- result = subprocess.call(CommandToRun([args.strip, '--strip-unneeded',
- '-o', args.output, args.sofile]))
+ result = subprocess.call(wrapper_utils.CommandToRun(
+ [args.strip, '--strip-unneeded', '-o', args.output, args.sofile]))
return result
« no previous file with comments | « build/toolchain/gcc_compile_wrapper.py ('k') | build/toolchain/gcc_toolchain.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698