[libcxx-commits] [PATCH] D154140: [libc++] Run fuzzing tests in the CI and move the tests to the normal locations
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 5 10:26:19 PDT 2023
ldionne added inline comments.
================
Comment at: libcxx/test/std/algorithms/alg.modifying.operations/alg.unique/fuzz.unique.sh.cpp:1
//===----------------------------------------------------------------------===//
//
----------------
ldionne wrote:
> From https://buildkite.com/llvm-project/libcxx-ci/builds/27285#018908b8-92d3-42af-9094-090e2ac9773b:
>
> ```
> St11char_traitsIcESaIcEEE[_ZNK6fuzzer7Command12getFlagValueERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x2c9): undefined reference to `std::__throw_length_error(char const*)'
> /usr/bin/ld: (.text._ZNK6fuzzer7Command12getFlagValueERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK6fuzzer7Command12getFlagValueERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x2e1): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
> /usr/bin/ld: /usr/lib/llvm-17/lib/clang/17/lib/linux/libclang_rt.fuzzer-x86_64.a(FuzzerFork.cpp.o): in function `std::vector<unsigned long, std::allocator<unsigned long> >::insert(__gnu_cxx::__normal_iterator<unsigned long const*, std::vector<unsigned long, std::allocator<unsigned long> > >, unsigned long const&)':
> (.text._ZNSt6vectorImSaImEE6insertEN9__gnu_cxx17__normal_iteratorIPKmS1_EERS4_[_ZNSt6vectorImSaImEE6insertEN9__gnu_cxx17__normal_iteratorIPKmS1_EERS4_]+0x280): undefined reference to `std::__throw_length_error(char const*)'
> /usr/bin/ld: /usr/lib/llvm-17/lib/clang/17/lib/linux/libclang_rt.fuzzer-x86_64.a(FuzzerFork.cpp.o): in function `void std::vector<fuzzer::SizedFile, std::allocator<fuzzer::SizedFile> >::_M_realloc_insert<fuzzer::SizedFile const&>(__gnu_cxx::__normal_iterator<fuzzer::SizedFile*, std::vector<fuzzer::SizedFile, std::allocator<fuzzer::SizedFile> > >, fuzzer::SizedFile const&)':
> (.text._ZNSt6vectorIN6fuzzer9SizedFileESaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_[_ZNSt6vectorIN6fuzzer9SizedFileESaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_]+0xe9): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
> /usr/bin/ld:
> ...
> ```
>
> So it turns out that on our CI machine (which runs Linux), `/usr/lib/llvm-17/lib/clang/17/lib/linux/libclang_rt.fuzzer-x86_64.a` has been compiled against libstdc++. I guess that's because compiler-rt is compiled against libstdc++ by default in LLVM releases. However, the result is that we can't use that part of compiler-rt with `-nostdlib++`.
>
> @kcc Did you folks think about a way that the stdlib itself could use fuzzing? Are we doing something fundamentally wrong, or do we need to basically build our own compiler-rt against libc++ in order to do this?
Other options:
1. Only run the fuzzing tests when we're doing a bootstrapping build in the CI, since then we can (?) easily control which stdlib compiler-rt is built against (I think). I think `COMPILER_RT_CXX_LIBRARY="libcxx"` will do that.
2. Always build a version of compiler-rt against libc++ in our CI and pass that to the test suite so it can set the right `--rtlib=` flag in Clang. We'd only want to do that for fuzzing tests, since we definitely don't want to customize the compiler-rt in use for our general tests.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154140/new/
https://reviews.llvm.org/D154140
More information about the libcxx-commits
mailing list