Bug 1426176 - Add symbols file for Clang ASan runtime on Windows. r=ted
☠☠ backed out by 249ef856193d ☠ ☠
authorChristian Holler <choller@mozilla.com>
Thu, 26 Jul 2018 11:16:50 +0200
changeset 429290 df39b3369446d0dabf426b270026445b2b0c83fc
parent 429289 43eacc8458b87a83278cb6aed42d88c9409a73c7
child 429291 0bde8c96f409d01b9f054b55d9c4eb2f95bb3099
push id34359
push usershindli@mozilla.com
push dateTue, 31 Jul 2018 09:53:19 +0000
treeherdermozilla-central@5a49a2ff0ee0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1426176
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1426176 - Add symbols file for Clang ASan runtime on Windows. r=ted MozReview-Commit-ID: 4P3mwZNP8cY
build/build-clang/build-clang.py
build/moz.build
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -129,16 +129,31 @@ def install_libgcc(gcc_dir, clang_dir):
     copy_tree(include_dir, clang_include_dir)
 
 
 def install_import_library(build_dir, clang_dir):
     shutil.copy2(os.path.join(build_dir, "lib", "clang.lib"),
                  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-x86_64.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])
 
 
 def svn_update(directory, revision):
     run_in(directory, ["svn", "revert", "-q", "-R", "."])
     run_in(directory, ["svn", "update", "-q", "-r", revision])
 
@@ -221,16 +236,17 @@ def build_one_stage(cc, cxx, asm, ld, ar
     build_package(build_dir, cmake_args)
 
     if is_linux():
         install_libgcc(gcc_dir, inst_dir)
     # For some reasons the import library clang.lib of clang.exe is not
     # 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
 # variable is defined in the config file, and if so we make sure it's an
 # absolute path to an existing tool, otherwise we look for a program in
 # $PATH named "key".
 #
 # This expects the name of the key in the config file to match the name of
--- a/build/moz.build
+++ b/build/moz.build
@@ -45,16 +45,17 @@ if CONFIG['MOZ_DMD']:
 # by GDB when we debug executables there.
 FINAL_TARGET_FILES += ['/.gdbinit']
 FINAL_TARGET_PP_FILES += ['.gdbinit_python.in']
 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']]
 
 if CONFIG['MOZ_APP_BASENAME']:
     appini_defines = {
         'TOPOBJDIR': TOPOBJDIR,
     }