[libcxx-commits] [PATCH] D106082: [runtimes] Don't try passing --target flags to GCC
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 15 10:14:46 PDT 2021
ldionne created this revision.
ldionne added a reviewer: phosek.
Herald added subscribers: libcxx-commits, mgorny.
Herald added a project: libunwind.
Herald added a reviewer: libunwind.
ldionne requested review of this revision.
Herald added projects: libc++, libc++abi.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.
When a target triple is specified in CMake via XXX_TARGET_TRIPLE, we tried
passing the --target=<...> flag to the compiler. However, not all compilers
support that flag (e.g. GCC, which is not a cross-compiler). As a result,
setting e.g. LIBCXX_TARGET_TRIPLE=<host-triple> would end up trying to
pass --target=<host-triple> to GCC, which breaks everything because the
flag isn't even supported.
This commit only adds `--target=<...>` & friends to the flags if it is
supported by the compiler.
One could argue that it's confusing to pass LIBCXX_TARGET_TRIPLE=<...>
and have it be ignored. That's correct, and one possibility would be
to assert that the requested triple is the same as the host triple when
we know the compiler is unable to cross-compile. However, note that this
is a pre-existing issue (setting the TARGET_TRIPLE variable never had an
influence on the flags passed to the compiler), and also fixing that is
starting to look like reimplementing a lot of CMake logic that is already
handled with CMAKE_CXX_COMPILER_TARGET.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D106082
Files:
libcxx/CMakeLists.txt
libcxx/cmake/Modules/HandleLibcxxFlags.cmake
libcxxabi/CMakeLists.txt
libcxxabi/cmake/Modules/HandleLibcxxabiFlags.cmake
libunwind/CMakeLists.txt
libunwind/cmake/Modules/HandleLibunwindFlags.cmake
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106082.359037.patch
Type: text/x-patch
Size: 5484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210715/51f9a5d0/attachment.bin>
More information about the libcxx-commits
mailing list