[libcxx-dev] Test failures for system with no threads

Hafiz Abid Qadeer via libcxx-dev libcxx-dev at lists.llvm.org
Thu Aug 13 08:45:08 PDT 2020

I test libcxx for baremetal targets and I recently saw many test
failures. Upon investigation, it seems that recent config changes have
altered when available_features is populated. This is causing wrong set
of libraries to be linked. Here are more details:

Previously features like 'libcpp-has-no-threads' were added in the
available_features in parse_config_site_and_add_features
which was called before configure_link_flags. So when control reached
LinuxLocalTI.add_cxx_link_flags (called from configure_link_flags),
available_features was already populated. The add_cxx_link_flags could
check whether feature like 'libcpp-has-no-threads' is present or not and
link -lpthread accordingly

After recent changes, the 'available_features' is populated in
newconfig.configure which is called after configure_link_flags. As a
result, when add_cxx_link_flags is called, the 'available_features' is
empty and add_cxx_link_flags always calculates enable_threads to be true.

I assume that enable_threads is true on most systems so thats why this
error was not caught. I was testing with LIBCXX_ENABLE_THREADS set to
false so noticed this error.

I am working on a fix unless someone beats me to it. But would
appreciate if somebody who is more familiar with this area can confirm
that my analysis is correct.

Hafiz Abid Qadeer
Mentor Embedded/CodeSourcery

More information about the libcxx-dev mailing list