[llvm-dev] LLVM Runtimes: Multilib support and variable overrides

Nagurne, James via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 12 12:26:17 PST 2019


Hi Petr, I've added you to this question directly as it seems you're the one that last touched it.

I'm currently having trouble working with llvm/runtimes with regards to LLVM_RUNTIME_MULTILIBS where I have some pseudo-cmake in my cache that looks like:

foreach (target in ${RUNTIME_TARGETS})
    set(RUNTIMES_${target}_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
    set(RUNTIMES_${target}+except_LIBCXX_ENABLE_EXCEPTIONS ON CACHE BOOL "")
endforeach()
set(LLVM_RUNTIME_MULTILIBS "except" CACHE STRING "")
set(LLVM_RUNTIME_MULTILIB_except_TARGETS "${RUNTIME_TARGETS}" CACHE STRING "")
set(LLVM_RUNTIME_TARGETS "${RUNTIME_TARGETS}" CACHE STRING "")

I'm finding that the '+except' case has LIBCXX_ENABLE_EXCEPTIONS OFF. I've tracked it down to how variables are passed to the subproject:

In llvm/runtimes/CMakeLists.txt, there's a loop:

    get_cmake_property(variableNames VARIABLES)
    foreach(variableName ${variableNames})
      string(FIND "${variableName}" "RUNTIMES_${name}_" out)
      if("${out}" EQUAL 0)
        string(REPLACE "RUNTIMES_${name}_" "" new_name ${variableName})
        list(APPEND ${name}_extra_args "-D${new_name}=${${variableName}}")
      endif()
      string(FIND "${variableName}" "RUNTIMES_${target}_" out)
      if("${out}" EQUAL 0)
        string(REPLACE "RUNTIMES_${target}_" "" new_name ${variableName})
        list(APPEND ${name}_extra_args "-D${new_name}=${${variableName}}")
      endif()
    endforeach()

This loop preferences variable order in the cmake cache. In my case, the RUNTIMES_${target}_LIBCXX_ENABLE_EXCEPTIONS variables all appear in the cache after the RUNTIMES_${target}+except_LIBCXX_ENABLE_EXCEPTIONS variables, and the former takes precedence. Is this expected behavior and I'm doing something incorrectly, or should this loop preference specific overrides (+except) over less specific overrides?

Regards,
JB
Code Generation
Texas Instruments
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191212/48815cbd/attachment.html>


More information about the llvm-dev mailing list