Bug 1524079 - Try both host and target clang to find llvm-objdump. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 04 Feb 2019 18:10:10 +0000
changeset 457217 8f654b18100761f30dc0edf5fae87541207966bd
parent 457216 88f45113318e8dae554f94768cd7b41cbb357137
child 457218 820960a3b0eeca944b16da6a760354aeb7947b5e
push id111711
push usercsabou@mozilla.com
push dateTue, 05 Feb 2019 23:12:20 +0000
treeherdermozilla-inbound@48b467365ea8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1524079
milestone67.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 1524079 - Try both host and target clang to find llvm-objdump. r=froydnj When doing android cross builds, the target compiler might be clang, but it might be the one from the NDK, which doesn't come with all the tools. So `clang --print-prog-name=llvm-objdump` might not return anything, when the system has a suffixed llvm-objdump, e.g. llvm-objdump-6.0. So it's better to check with the host compiler, which is likely clang too. We still check with the target compiler, in the odd case where the host and target compiler would be of different kinds (Windows cross-builds). Differential Revision: https://phabricator.services.mozilla.com/D18142
moz.configure
--- a/moz.configure
+++ b/moz.configure
@@ -579,24 +579,28 @@ def nsis_flags(host):
         return '-nocd'
     return ''
 
 set_config('MAKENSISU_FLAGS', nsis_flags)
 
 check_prog('7Z', ('7z', '7za'), allow_missing=True, when=target_is_windows)
 
 
-@depends(c_compiler, bindgen_config_paths)
-def llvm_objdump(c_compiler, bindgen_config_paths):
+@depends(host_c_compiler, c_compiler, bindgen_config_paths)
+def llvm_objdump(host_c_compiler, c_compiler, bindgen_config_paths):
     clang = None
-    if c_compiler and c_compiler.type == 'clang':
-        clang = c_compiler.compiler
-    elif c_compiler and c_compiler.type == 'clang-cl':
-        clang = os.path.join(os.path.dirname(c_compiler.compiler), 'clang')
-    elif bindgen_config_paths:
+    for compiler in (host_c_compiler, c_compiler):
+        if compiler and compiler.type == 'clang':
+            clang = compiler.compiler
+            break
+        elif compiler and compiler.type == 'clang-cl':
+            clang = os.path.join(os.path.dirname(compiler.compiler), 'clang')
+            break
+
+    if not clang and bindgen_config_paths:
         clang = bindgen_config_paths.clang_path
     llvm_objdump = 'llvm-objdump'
     if clang:
         out = check_cmd_output(clang, '--print-prog-name=llvm-objdump',
                                onerror=lambda: None)
         if out:
             llvm_objdump = out.rstrip()
     return (llvm_objdump,)