[PATCH] D24156: [CMake] Explicitly add --target option to compiler flags

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 14:57:55 PDT 2016


beanz added a comment.

`COMPILER_RT_DEFAULT_TARGET_TRIPLE` defaults today to whatever the `TARGET_TRIPLE` is from LLVM, which should be the default target triple of clang. It can be overridden in a dozen or so ways, but that is the default expected behavior.

The complication in the build system is that Compiler-RT's build assumes that `COMPILER_RT_DEFAULT_TARGET` is the compiler's default target, even if it isn't. This comes into play in the target tests where it differentiates Arm32 from AArch64 by passing the `-m64` compiler flag, and it passes `-mcpu` to the ArmV7 builds without passing `-target`. In general these issues cause the configuration checks to fail or silently incorrectly succeed, when you are building multi-arch libraries with a multi-targeting compiler.

I'm trying to come up with a solution where I can support building multi-targeting cross-compilers simply from a single configuration. My experimental patch is https://reviews.llvm.org/P7504, this supports configuring LLVM & Clang something like:

  cmake -G ... -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" -DLLVM_BUILTIN_TARGETS="i686-unknown-freebsd;armv7-unknown-freebsd;aarch64-unknown-freebsd"

Which will generate `builtins-<triple>` targets as part of `all`. Allowing you to simply build a multi-target compiler from a single build configuration.

If the `COMPILER_RT_DEFAULT_TARGET ` is `arm-linux-gnueabi`, and that gets passed to `-target` is that a problem? Anecdotally it seems to me that it isn't, but @fjricci implied that it is.


https://reviews.llvm.org/D24156





More information about the llvm-commits mailing list