mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Shoaib Meenai
c6c2e0aed2
[runtimes] Allow LLVM_BUILTIN_TARGETS to include Darwin
We have two ways of using the runtimes build setup to build the builtins. You can either have an empty LLVM_BUILTIN_TARGETS (or have it include the "default" target), in which case builtin_default_target is called to set up the default target, or you can have actual triples in LLVM_BUILTIN_TARGETS, in which case builtin_register_target is called for each triple. builtin_default_target lets you build the builtins for Darwin (assuming your default triple is Darwin); builtin_register_target does not. I don't understand the reason for this distinction. The Darwin builtins build is special in that a single CMake configure handles building the builtins for multiple platforms (e.g. macOS, iPhoneSimulator, and iOS) and architectures (e.g. arm64, armv7, and x86_64). Consequently, if you specify multiple Darwin triples in LLVM_BUILTIN_TARGETS, expecting each configure to only build for that particular triple, it won't work. However, if you specify a *single* x86_64-apple-darwin triple in LLVM_BUILTIN_TARGETS, that single configure will build the builtins for all Darwin targets, exactly the same way that the default target would. The only difference between the configuration for the default target and the x86_64-apple-darwin triple is that the latter runs the configuration with `-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON`, but that makes no difference for Apple targets (none of the CMake codepaths which have different behavior based on that variable are run for Apple targets). I tested this by running two builtins builds on my Mac, one with the default target and one with the x86_64-apple-darwin19.5.0 target (which is the default target triple for my clang). The only relevant CMakeCache.txt difference was the following, and as discussed above, it has no effect on the actual build for Apple targets: ``` -//Default triple for which compiler-rt runtimes will be built. -COMPILER_RT_DEFAULT_TARGET_TRIPLE:STRING=x86_64-apple-darwin19.5.0 +//No help, variable specified on the command line. +COMPILER_RT_DEFAULT_TARGET_ONLY:UNINITIALIZED=ON ``` Furthermore, when I add the `-D` flag to compiler-rt's libtool invocations, the libraries produced by the two builds are *identical*. If anything, I would expect builtin_register_target to complain if you tried specifying a triple for a particular Apple platform triple (e.g. macosx), since that's the scenario in which it won't work as you want. The generic darwin triple should be fine though, as best as I can tell. I'm happy to add the error for specific Apple platform triples, either in this diff or in a follow-up. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D86313
The LLVM Compiler Infrastructure ================================ This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments. LLVM is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt. Please see the documentation provided in docs/ for further assistance with LLVM, and in particular docs/GettingStarted.rst for getting started with LLVM and docs/README.txt for an overview of LLVM's documentation setup. If you are writing a package for LLVM, see docs/Packaging.rst for our suggestions.
Description
Languages
C++
96.9%
C
1%
Python
1%
CMake
0.6%
OCaml
0.2%
Other
0.1%