[PATCH] D31639: [CMake][libcxxabi] Use -nodefaultlibs for CMake checks
Kazushi Marukawa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 19 05:11:51 PST 2021
kaz7 added a comment.
Hi, I have a question about this patch. I appreciate any answers. Thanks!
================
Comment at: libcxxabi/trunk/cmake/config-ix.cmake:26
+ find_compiler_rt_library(builtins LIBCXXABI_BUILTINS_LIBRARY)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBCXXABI_BUILTINS_LIBRARY}")
+ elseif (LIBCXXABI_HAS_GCC_S_LIB)
----------------
Hi!
Is it possible to ask about this implementation?
I'm trying to build `libcxxabi.so` and `libclang_rt.builtins-ve.a` for VE architecture. However, generated `libcxxabi.so` requires `libclang_rt.builtins-ve.a` for `__multi3` function. Then, ld causes following errors, when I compile any c++ test programs using generated `clang++`, `libc++.so`, `libcxxabi.so`, and `libclang_rt.builtins-ve.a`. I think that this is an error trying to refer `__multi3` function in `libclang_rt.builtins-ve.a` from `libcxxabi.so`.
```
/opt/nec/ve/bin/nld: cmTC_f428b: hidden symbol `__veabi_multi3' in /home/jam/llvm-upstream/install/lib/clang/12.0.0/lib/linux/libclang_rt.builtins-ve.a(multi3.c.o) is referenced by DSO
/opt/nec/ve/bin/nld: final link failed: Bad value
```
In order to solve this problem, I can add following CMakefile code to link `libcxxabi.so` with `libclang_rt.builtins-ve.a` at build-time. It works fine for VE. But, I'm not sure whther this modification works for all other architectures or not. Or, I guess, there is better answer for this problem.
```
list(APPEND CMAKE_REQUIRED_FLAGS -rtlib=compiler-rt)
find_compiler_rt_library(builtins LIBCXXABI_BUILTINS_LIBRARY)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBCXXABI_BUILTINS_LIBRARY}")
+ # CMAKE_REQUIRED_LIBRARIES is not used to link libc++abi.so, so
+ # append builtins to LIBCXXABI_SHARED_LIBRARIES too
+ list(APPEND LIBCXXABI_SHARED_LIBRARIES "${LIBCXXABI_BUILTINS_LIBRARY}")
```
I appreciate if you have any suggestions for me here. Thanks!
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D31639/new/
https://reviews.llvm.org/D31639
More information about the llvm-commits
mailing list