[PATCH] D74133: Fix for PR38025

Riyaz V Puthiyapurayil via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 21 10:23:53 PST 2020


RVP added a comment.

>> I'd prefer if we would invoke `find_compiler_rt_library` only once per target. Two ways I could think to achieve that is to either (1) move these invocations to another location such as `compiler-rt/cmake/config-ix.cmake` and store the result in a global variable which would then be used in `add_compiler_rt_runtime`, or (2) cache the result value in `find_compiler_rt_library` and avoid re-invoking Clang if the value is already set. I'm leaning towards (1) which seems cleaner.

I looked at what it would take to do (1). The problem is that there is no global list of all known targets. Different libraries have different lists of supported targets. I thought, maybe I could just pass --target=unknown to clang and then save the output in a global variable. Then for a given library and for a given target, I could replace "unknown" in the library path with the desired target (just like builtins is replaced by the library name today) and check if that file exists. But unfortunately, it is not so simple. For example, the target name used in CMake could be ppc64 and clang would return powerpc64 for the target part in the library name. To handle this, I will have to keep such mapping somewhere duplicating what clang is already doing. This seems to be not such a clean solution anymore. Wonder if I should instead pursue solution (2) of caching the result value and avoid re-invoking Clang. Any thoughts?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74133/new/

https://reviews.llvm.org/D74133





More information about the llvm-commits mailing list