--- chromium-81.0.4044.26/build/toolchain/gcc_solink_wrapper.py 2020-02-20 03:32:08.000000000 +0300 +++ chromium-81.0.4044.26/build/toolchain/gcc_solink_wrapper.py 2020-02-27 01:33:05.218881468 +0300 @@ -11,6 +11,7 @@ """ import argparse +import io import os import subprocess import sys @@ -18,12 +19,18 @@ import wrapper_utils +def read_as_utf8(fileno): + fp = io.open(fileno, mode="r", encoding="utf-8", closefd=False) + content = fp.read() + fp.close() + return content + 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) - for line in readelf.stdout: + for line in read_as_utf8(readelf.stdout.fileno()): if 'SONAME' in line: toc += line return readelf.wait(), toc @@ -35,7 +42,7 @@ nm = subprocess.Popen(wrapper_utils.CommandToRun([ args.nm, '--format=posix', '-g', '-D', args.sofile]), stdout=subprocess.PIPE, bufsize=-1) - for line in nm.stdout: + for line in read_as_utf8(nm.stdout.fileno()): toc += ' '.join(line.split(' ', 2)[:2]) + '\n' return nm.wait(), toc