This is an archive of the discontinued LLVM Phabricator instance.

[CMake][compiler-rt] Support for using in-tree libc++
AbandonedPublic

Authored by phosek on Apr 1 2022, 12:25 PM.

Details

Summary

compiler-rt build has several options for choosing C++ ABI and C++
library for testing. These options are inadequate and incorrect as they
don't set the dependencies correctly when using in-tree libc++ and don't
support runtimes like ORC or XRay that use C++ library.

This change replaces these options with COMPILER_RT_USE_LIBCXX that
determines whether to use in-tree libc++ or not. If yes, it correctly
sets the dependendencies using generator expresions. If not, users
should use standard flags like CMAKE_CXX_FLAGS to select their preferred
C++ standard library.

Diff Detail

Event Timeline

phosek created this revision.Apr 1 2022, 12:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2022, 12:25 PM
phosek requested review of this revision.Apr 1 2022, 12:25 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 1 2022, 12:25 PM
Herald added subscribers: Restricted Project, cfe-commits. · View Herald Transcript

I like this, however IMO it would be better to instead have something like

COMPILER_RT_CXX_LIBRARY="libc++|system-libc++|libstdc++|..."

That way, this can be extended to support other C++ libraries without having to add new boolean options, and without forcing folks to use ad-hoc CMAKE_CXX_FLAGS in their builds. WDYT?

compiler-rt/CMakeLists.txt
513–515

I'm not sure I follow here -- we don't support using LLVM_ENABLE_PROJECTS=libcxx anymore.

517–534

Is there any reason why this can't be hardcoded to ${LLVM_MAIN_SRC_DIR}/.../libcxx? Why do we need to handle the other layouts?

Edit: Oh, I see, this was only moved around. I assume you prefer making these other changes in separate patches.

smeenai requested changes to this revision.Apr 28 2022, 1:38 PM

(clearing my queue while there are unaddressed comments)

This revision now requires changes to proceed.Apr 28 2022, 1:38 PM
phosek added inline comments.Jun 17 2022, 12:48 AM
compiler-rt/CMakeLists.txt
513–515

I cleaned this in D126905.

517–534

I have created D126905 to clean up these flags.

phosek marked 2 inline comments as done.Jun 17 2022, 12:48 AM
phosek abandoned this revision.Jul 10 2022, 3:11 PM

This was broken up into a series of smaller changes which landed separately.