mirror of https://github.com/google/oss-fuzz.git
infra: stop patching llvm-symbolizer (#5839)
* infra: stop patching llvm-symbolizer to prevent it from failing to start up with ``` NEW_FUNC[1/1]: llvm-symbolizer: symbol lookup error: /tmp/not-out/instrumented_libraries/lib/x86_64-linux-gnu/libz.so.1: undefined symbol: __msan_va_arg_overflow_size_tls ==45==WARNING: external symbolizer didn't start up correctly! ``` Closes https://github.com/google/oss-fuzz/issues/5349 * infra: reformat patch_build.py with yapf to make the presubmit check happy
This commit is contained in:
parent
f8815194c4
commit
ff25180bd7
|
@ -36,7 +36,8 @@ def IsElf(file_path):
|
||||||
def Ldd(binary_path):
|
def Ldd(binary_path):
|
||||||
"""Run ldd on a file."""
|
"""Run ldd on a file."""
|
||||||
try:
|
try:
|
||||||
output = subprocess.check_output(['ldd', binary_path], stderr=subprocess.STDOUT)
|
output = subprocess.check_output(['ldd', binary_path],
|
||||||
|
stderr=subprocess.STDOUT)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print('Failed to call ldd on', binary_path, file=sys.stderr)
|
print('Failed to call ldd on', binary_path, file=sys.stderr)
|
||||||
return []
|
return []
|
||||||
|
@ -59,7 +60,7 @@ def FindLib(path):
|
||||||
candidate_path = os.path.join(MSAN_LIBS_PATH, path[1:])
|
candidate_path = os.path.join(MSAN_LIBS_PATH, path[1:])
|
||||||
if os.path.exists(candidate_path):
|
if os.path.exists(candidate_path):
|
||||||
return candidate_path
|
return candidate_path
|
||||||
|
|
||||||
for lib_dir in os.listdir(MSAN_LIBS_PATH):
|
for lib_dir in os.listdir(MSAN_LIBS_PATH):
|
||||||
candidate_path = os.path.join(MSAN_LIBS_PATH, lib_dir, path[1:])
|
candidate_path = os.path.join(MSAN_LIBS_PATH, lib_dir, path[1:])
|
||||||
if os.path.exists(candidate_path):
|
if os.path.exists(candidate_path):
|
||||||
|
@ -78,7 +79,8 @@ def PatchBinary(binary_path, instrumented_dir):
|
||||||
|
|
||||||
instrumented_path = FindLib(path)
|
instrumented_path = FindLib(path)
|
||||||
if not instrumented_path:
|
if not instrumented_path:
|
||||||
print('WARNING: Instrumented library not found for', path,
|
print('WARNING: Instrumented library not found for',
|
||||||
|
path,
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -105,9 +107,9 @@ def PatchBinary(binary_path, instrumented_dir):
|
||||||
print('Patching rpath for', binary_path, 'from', existing_rpaths, 'to',
|
print('Patching rpath for', binary_path, 'from', existing_rpaths, 'to',
|
||||||
processed_rpaths)
|
processed_rpaths)
|
||||||
|
|
||||||
subprocess.check_call(
|
subprocess.check_call([
|
||||||
['patchelf', '--force-rpath', '--set-rpath',
|
'patchelf', '--force-rpath', '--set-rpath', processed_rpaths, binary_path
|
||||||
processed_rpaths, binary_path])
|
])
|
||||||
|
|
||||||
|
|
||||||
def PatchBuild(output_directory):
|
def PatchBuild(output_directory):
|
||||||
|
@ -119,6 +121,9 @@ def PatchBuild(output_directory):
|
||||||
|
|
||||||
for root_dir, _, filenames in os.walk(output_directory):
|
for root_dir, _, filenames in os.walk(output_directory):
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
|
if filename == "llvm-symbolizer":
|
||||||
|
continue
|
||||||
|
|
||||||
file_path = os.path.join(root_dir, filename)
|
file_path = os.path.join(root_dir, filename)
|
||||||
|
|
||||||
if os.path.islink(file_path):
|
if os.path.islink(file_path):
|
||||||
|
@ -131,7 +136,8 @@ def PatchBuild(output_directory):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser('patch_build.py', description='MSan build patcher.')
|
parser = argparse.ArgumentParser('patch_build.py',
|
||||||
|
description='MSan build patcher.')
|
||||||
parser.add_argument('output_dir', help='Output directory.')
|
parser.add_argument('output_dir', help='Output directory.')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
Loading…
Reference in New Issue