This is an archive of the discontinued LLVM Phabricator instance.

[libcxxabi] Provide options to set compiler/link flags for test programs.
AbandonedPublic

Authored by abidh on Sep 1 2020, 2:28 AM.

Details

Reviewers
ldionne
mstorsjo
EricWF
Group Reviewers
Restricted Project
Summary

Libunwind and libcxx have cmake variables to set the additional compiler and link flags needed to build a test program. The libcxxabi were missing those flags. This patch adds 'LIBCXXABI_TEST_LINKER_FLAGS' and 'LIBCXXABI_TEST_COMPILER_FLAGS' to fill this gap.

Diff Detail

Event Timeline

abidh created this revision.Sep 1 2020, 2:28 AM
Herald added a reviewer: Restricted Project. · View Herald TranscriptSep 1 2020, 2:28 AM
abidh requested review of this revision.Sep 1 2020, 2:28 AM
ldionne requested changes to this revision.Sep 1 2020, 7:17 AM

We'd like to move away from going through CMake to set test-only variables, as it's not a great mechanism for doing so. Instead, please consider using a custom Lit config file like libcxx/test/configs/libcxx-trunk-shared.cfg.in, which allows you to customize how you run the test suite a lot more.

This revision now requires changes to proceed.Sep 1 2020, 7:17 AM

We'd like to move away from going through CMake to set test-only variables, as it's not a great mechanism for doing so. Instead, please consider using a custom Lit config file like libcxx/test/configs/libcxx-trunk-shared.cfg.in, which allows you to customize how you run the test suite a lot more.

To explain my point, what we're trying to avoid is to go through CMake in order to change specific Lit parameters. It's not a great model if for each Lit-related "customization point" we have, we also need to add a CMake variable and an entry in the lit.site.cfg.in file. It leads to bloated and complicated CMake files. Instead, modifying how you run lit directly is both more powerful and simpler.

Please take a look at libcxx/test/configs/libcxx-trunk-shared.cfg.in and LIBCXX_TEST_CONFIG in CMake for how to customize exactly how you're running the test suite. This is a lot more powerful and simple than stringing options through CMake!

abidh added a comment.Sep 15 2020, 1:38 AM

Please take a look at libcxx/test/configs/libcxx-trunk-shared.cfg.in and LIBCXX_TEST_CONFIG in CMake for how to customize exactly how you're running the test suite. This is a lot more powerful and simple than stringing options through CMake!

Thanks. I found this variable and I tried using it with an out of tree file that was customized for my target and it works. This patch though does make CMake variable set consistent in libunwind/libcxxabi/libcxx. Otherwise we will have these variables in libunwind and libcxx and not in libcxxabi. If that is not important then I can abandon this patch.

The approach to be taken for all runtime libraries is the one I described with specifying a custom config file. Please abandon!

abidh abandoned this revision.Sep 15 2020, 5:27 AM