Bug 1784202 - Properly set target flags for clang mac builds. r=firefox-build-system-reviewers,andi

Currently, when building clang for mac, which we cross-compile, we're
always passing a x86-64 target, even on arm64. This cancels out with the
LLVM build system adding `-arch arm64`, so it worked fine... until clang
15, where some things end up being built without `-arch arm64` and
things end up broken.

Differential Revision: https://phabricator.services.mozilla.com/D156258
This commit is contained in:
Mike Hommey
2022-09-04 21:01:53 +00:00
parent 7211d40d6f
commit a77db9ce0f

View File

@@ -285,6 +285,9 @@ def build_one_stage(
"-DDARWIN_osx_ARCHS=%s" % arch,
"-DDARWIN_osx_SYSROOT=%s" % slashify_path(os.getenv("CROSS_SYSROOT")),
"-DLLVM_DEFAULT_TARGET_TRIPLE=%s-apple-darwin" % target_cpu,
"-DCMAKE_C_COMPILER_TARGET=%s-apple-darwin" % target_cpu,
"-DCMAKE_CXX_COMPILER_TARGET=%s-apple-darwin" % target_cpu,
"-DCMAKE_ASM_COMPILER_TARGET=%s-apple-darwin" % target_cpu,
]
if os.environ.get("OSX_ARCH") == "arm64":
cmake_args += [
@@ -682,8 +685,6 @@ def main():
extra_cxxflags2 = ["-stdlib=libc++"]
extra_flags = [
"-target",
"x86_64-apple-darwin",
"-mlinker-version=137",
"-B",
"%s/bin" % os.getenv("CROSS_CCTOOLS_PATH"),