From 75e5225c778526d89a2015acf39b6e3d4dc6a2ec Mon Sep 17 00:00:00 2001 From: Christian Holler Date: Thu, 26 Jul 2018 11:16:50 +0200 Subject: [PATCH] Bug 1426176 - Add symbols file for Clang ASan runtime on Windows. r=ted MozReview-Commit-ID: 4P3mwZNP8cY --HG-- extra : histedit_source : ef086a01cdb2d228b93ee1be018033f7390fa055%2C1454c0f70d38a56f9c78e4d9b29107409c18726b --- build/build-clang/build-clang.py | 16 ++++++++++++++++ build/moz.build | 1 + 2 files changed, 17 insertions(+) diff --git a/build/build-clang/build-clang.py b/build/build-clang/build-clang.py index 94141ca4b229..b9ec51419893 100755 --- a/build/build-clang/build-clang.py +++ b/build/build-clang/build-clang.py @@ -134,6 +134,21 @@ def install_import_library(build_dir, clang_dir): os.path.join(clang_dir, "lib")) +def install_asan_symbols(build_dir, clang_dir): + lib_path_pattern = os.path.join("lib", "clang", "*.*.*", "lib", "windows") + src_path = glob.glob(os.path.join(build_dir, lib_path_pattern, + "clang_rt.asan_dynamic-*.pdb")) + dst_path = glob.glob(os.path.join(clang_dir, lib_path_pattern)) + + if len(src_path) != 1: + raise Exception("Source path pattern did not resolve uniquely") + + if len(src_path) != 1: + raise Exception("Destination path pattern did not resolve uniquely") + + shutil.copy2(src_path[0], dst_path[0]) + + def svn_co(source_dir, url, directory, revision): run_in(source_dir, ["svn", "co", "-q", "-r", revision, url, directory]) @@ -226,6 +241,7 @@ def build_one_stage(cc, cxx, asm, ld, ar, ranlib, libtool, # installed, so we copy it by ourselves. if is_windows(): install_import_library(build_dir, inst_dir) + install_asan_symbols(build_dir, inst_dir) # Return the absolute path of a build tool. We first look to see if the diff --git a/build/moz.build b/build/moz.build index 95739ee27236..bb9d9befdec3 100644 --- a/build/moz.build +++ b/build/moz.build @@ -50,6 +50,7 @@ OBJDIR_FILES += ['!/dist/bin/.gdbinit_python'] # Install the clang-cl runtime library for ASAN next to the binaries we produce. if CONFIG['MOZ_ASAN'] and CONFIG['CC_TYPE'] == 'clang-cl': FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']] + FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH'].replace(".dll", ".pdb")] if CONFIG['LLVM_SYMBOLIZER']: FINAL_TARGET_FILES += ['/' + CONFIG['LLVM_SYMBOLIZER']]