Bug 1524079 - Try both host and target clang to find llvm-objdump. r?build draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 31 Jan 2019 07:47:43 +0900
changeset 1823890 8738c1d3a4c45e6d85f172ec56041f5d0257e204
parent 1823889 6950814f226b3b8da4dd7f6607ac819d32134251
child 1823891 6c3c5d7abe33416427217514a0ccc8a58ca790c3
push id330941
push usermh@glandium.org
push dateThu, 31 Jan 2019 02:13:23 +0000
treeherdertry@2678d0f8f38f [default view] [failures only]
Bug 1524079 - Try both host and target clang to find llvm-objdump. r?build 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
--- 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,)