mold
mold copied to clipboard
mold error on armv7l building openmp 15.0.2
The issue goes away when I switch to using lld.
[32/34] Building CXX object runtime/src/CMakeFiles/omp.dir/kmp_version.cpp.o
clang-15: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang-15: warning: argument unused during compilation: '-fuse-ld=mold' [-Wunused-command-line-argument]
[33/34] Building CXX object runtime/src/CMakeFiles/omp.dir/kmp_ftn_extra.cpp.o
clang-15: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang-15: warning: argument unused during compilation: '-fuse-ld=mold' [-Wunused-command-line-argument]
[34/34] Linking C shared library runtime/src/libomp.so
FAILED: runtime/src/libomp.so
: && /usr/local/bin/clang --target=armv7l-cros-linux-gnueabihf -fPIC -O2 -pipe -ffat-lto-objects -fPIC -fuse-ld=mold -O3 -DNDEBUG -flto=thin -Wl,--warn-shared-textrel -Wl,--as-needed -Wl,--version-script=/usr/local/tmp/crew/openmp.20221006160057.dir/llvm-project-15.0.2.src/openmp/runtime/src/exports_so.txt -static-libgcc -Wl,-z,noexecstack -shared -Wl,-soname,libomp.so -o runtime/src/libomp.so runtime/src/CMakeFiles/omp.dir/kmp_alloc.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_atomic.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_debug.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_itt.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_environment.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_error.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_global.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_i18n.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_io.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_runtime.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_settings.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_str.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_tasking.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_threadprivate.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_utility.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_barrier.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_affinity.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_dispatch.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_lock.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_sched.cpp.o runtime/src/CMakeFiles/omp.dir/z_Linux_util.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o runtime/src/CMakeFiles/omp.dir/thirdparty/ittnotify/ittnotify_static.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_taskdeps.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_cancel.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_ftn_cdecl.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_ftn_extra.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_version.cpp.o runtime/src/CMakeFiles/omp.dir/z_Linux_asm.S.o -lpthread -lrt -lm -ldl && cd /usr/local/tmp/crew/openmp.20221006160057.dir/llvm-project-15.0.2.src/openmp/builddir/runtime/src && /usr/local/bin/cmake -E create_symlink libomp.so libgomp.so && /usr/local/bin/cmake -E create_symlink libomp.so libiomp5.so
mold: error: /usr/local/tmp/lto-llvm-8fa860.o:(.ARM.extab.text._ZL29__kmp_aux_affinity_initializev.llvm.18442078347579705281): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-8fa860.o:(.ARM.extab.text._ZN17KMPNativeAffinity13allocate_maskEv): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-8fa860.o:(.ARM.extab.text._ZN17KMPNativeAffinity19allocate_mask_arrayEi): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-61cc35.o:(.ARM.extab.text.omp_set_affinity_format): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-8fa860.o:(.ARM.extab.text._ZL33__kmp_affinity_create_cpuinfo_mapPiP11kmp_i18n_id): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-61cc35.o:(.ARM.extab.text._ZN15ConvertedStringD2Ev): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-61cc35.o:(.ARM.extab.text.omp_display_affinity): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-61cc35.o:(.ARM.extab.text.omp_capture_affinity): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-416c90.o:(.ARM.extab.text.__kmp_api_omp_set_affinity_format_): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-416c90.o:(.ARM.extab.text.__kmp_api_omp_display_affinity_): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-416c90.o:(.ARM.extab.text.__kmp_api_omp_capture_affinity_): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
Build log from broken build: openmp-15.0.2-armv7l-build.log Build log from working build: openmp-15.0.2-armv7l.log
Do you mind if I ask you to pack the entire build directory with tar and share it with me?
Here is the build dir:
https://gitlab.com/chromebrew/binaries/-/blob/main/armv7l/openmp_armv7l.build.gz
Hmm, it's hard to run it locally. Can you rebuild mold with the following patch and re-run the final link line to see what will be displayed?
diff --git a/elf/cmdline.cc b/elf/cmdline.cc
index bbbae394..1180d60d 100644
--- a/elf/cmdline.cc
+++ b/elf/cmdline.cc
@@ -421,10 +421,12 @@ std::vector<std::string> parse_nonpositional_args(Context<E> &ctx) {
return true;
}
return false;
};
+ ctx.arg.trace_symbol.push_back("__gxx_personality_v0");
+
while (!args.empty()) {
if (read_flag("help")) {
SyncOut(ctx) << "Usage: " << ctx.cmdline_args[0]
<< " [options] file...\n" << helpmsg;
exit(0);
diff --git a/elf/lto-unix.cc b/elf/lto-unix.cc
index 923b4ed2..200843fa 100644
--- a/elf/lto-unix.cc
+++ b/elf/lto-unix.cc
@@ -641,10 +641,13 @@ ObjectFile<E> *read_lto_object(Context<E> &ctx, MappedFile<Context<E>> *mf) {
std::vector<ElfSym<E>> *esyms = new std::vector<ElfSym<E>>(1);
for (PluginSymbol &psym : plugin_symbols) {
esyms->push_back(to_elf_sym<E>(psym));
obj->symbols.push_back(get_symbol(ctx, save_string(ctx, psym.name)));
+
+ if (psym.name == "__gxx_personality_v0"s)
+ SyncOut(ctx) << "__gxx_personality_v0 symbol type: " << psym.symbol_type;
}
obj->elf_syms = *esyms;
obj->symvers.resize(esyms->size());
plugin_symbols.clear();
Build log with mold built with above patch attached. openmp-15.0.2-test-armv7l.log
There was an issue in the previous patch which made the most important part garbled. Could you try again with this?
diff --git a/elf/cmdline.cc b/elf/cmdline.cc
index bbbae394..1180d60d 100644
--- a/elf/cmdline.cc
+++ b/elf/cmdline.cc
@@ -421,10 +421,12 @@ std::vector<std::string> parse_nonpositional_args(Context<E> &ctx) {
return true;
}
return false;
};
+ ctx.arg.trace_symbol.push_back("__gxx_personality_v0");
+
while (!args.empty()) {
if (read_flag("help")) {
SyncOut(ctx) << "Usage: " << ctx.cmdline_args[0]
<< " [options] file...\n" << helpmsg;
exit(0);
diff --git a/elf/lto-unix.cc b/elf/lto-unix.cc
index 923b4ed2..200843fa 100644
--- a/elf/lto-unix.cc
+++ b/elf/lto-unix.cc
@@ -641,10 +641,13 @@ ObjectFile<E> *read_lto_object(Context<E> &ctx, MappedFile<Context<E>> *mf) {
std::vector<ElfSym<E>> *esyms = new std::vector<ElfSym<E>>(1);
for (PluginSymbol &psym : plugin_symbols) {
esyms->push_back(to_elf_sym<E>(psym));
obj->symbols.push_back(get_symbol(ctx, save_string(ctx, psym.name)));
+
+ if (psym.name == "__gxx_personality_v0"s)
+ SyncOut(ctx) << "__gxx_personality_v0 symbol type: " << (u32)psym.symbol_type;
}
obj->elf_syms = *esyms;
obj->symvers.resize(esyms->size());
plugin_symbols.clear();
With new build:
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_taskdeps.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_runtime.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_cancel.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_debug.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_ftn_cdecl.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_barrier.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_lock.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_tasking.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/z_Linux_util.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_ftn_extra.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_affinity.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_dispatch.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/z_Linux_util.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_runtime.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_debug.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_barrier.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_affinity.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_tasking.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_cancel.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_ftn_cdecl.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_dispatch.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_taskdeps.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_lock.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_ftn_extra.cpp.o: reference to __gxx_personality_v0
trace-symbol: /usr/local/tmp/lto-llvm-333826.o: reference to __gxx_personality_v0
trace-symbol: /usr/local/tmp/lto-llvm-6a93fc.o: reference to __gxx_personality_v0
trace-symbol: /usr/local/tmp/lto-llvm-1fcf52.o: reference to __gxx_personality_v0
trace-symbol: /usr/local/tmp/lto-llvm-1fcf52.o: unresolved symbol __gxx_personality_v0
mold: error: /usr/local/tmp/lto-llvm-1fcf52.o:(.ARM.extab.text._ZL29__kmp_aux_affinity_initializev.llvm.10710035644970803546): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-333826.o:(.ARM.extab.text.omp_set_affinity_format): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-333826.o:(.ARM.extab.text._ZN15ConvertedStringD2Ev): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-6a93fc.o:(.ARM.extab.text.__kmp_api_omp_set_affinity_format_): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-6a93fc.o:(.ARM.extab.text.__kmp_api_omp_display_affinity_): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-6a93fc.o:(.ARM.extab.text.__kmp_api_omp_capture_affinity_): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-1fcf52.o:(.ARM.extab.text._ZN17KMPNativeAffinity13allocate_maskEv): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-333826.o:(.ARM.extab.text.omp_display_affinity): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-1fcf52.o:(.ARM.extab.text._ZN17KMPNativeAffinity19allocate_mask_arrayEi): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-333826.o:(.ARM.extab.text.omp_capture_affinity): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-1fcf52.o:(.ARM.extab.text._ZL33__kmp_affinity_create_cpuinfo_mapPiP11kmp_i18n_id): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
clang-15: error: linker command failed with exit code 1
Was there no __gxx_personality_v0 symbol type line in the log?
Full build log attached. openmp-15.0.2-test-armv7l.log
FAILED: runtime/src/libomp.so
: && /usr/local/bin/clang --target=armv7l-cros-linux-gnueabihf -fPIC -O2 -pipe -ffat-lto-objects -fPIC -fuse-ld=mold -O3 -DNDEBUG -flto=thin -Wl,--warn-shared-textrel -Wl,--as-needed -Wl,--version-script=/usr/local/tmp/crew/openmp.20221009100157.dir/llvm-project-15.0.2.src/openmp/runtime/src/exports_so.txt -static-libgcc -Wl,-z,noexecstack -shared -Wl,-soname,libomp.so -o runtime/src/libomp.so runtime/src/CMakeFiles/omp.dir/kmp_alloc.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_atomic.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_debug.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_itt.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_environment.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_error.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_global.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_i18n.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_io.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_runtime.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_settings.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_str.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_tasking.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_threadprivate.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_utility.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_barrier.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_affinity.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_dispatch.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_lock.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_sched.cpp.o runtime/src/CMakeFiles/omp.dir/z_Linux_util.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o runtime/src/CMakeFiles/omp.dir/thirdparty/ittnotify/ittnotify_static.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_taskdeps.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_cancel.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_ftn_cdecl.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_ftn_extra.cpp.o runtime/src/CMakeFiles/omp.dir/kmp_version.cpp.o runtime/src/CMakeFiles/omp.dir/z_Linux_asm.S.o -lpthread -lrt -lm -ldl && cd /usr/local/tmp/crew/openmp.20221009100157.dir/llvm-project-15.0.2.src/openmp/builddir/runtime/src && /usr/local/bin/cmake -E create_symlink libomp.so libgomp.so && /usr/local/bin/cmake -E create_symlink libomp.so libiomp5.so
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
__gxx_personality_v0 symbol type: 0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_taskdeps.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_runtime.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_cancel.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_debug.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_ftn_cdecl.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_barrier.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_lock.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_tasking.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/z_Linux_util.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_ftn_extra.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_affinity.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_dispatch.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/z_Linux_util.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_csupport.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_runtime.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_debug.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_barrier.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_wait_release.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_affinity.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_tasking.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_cancel.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_ftn_cdecl.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_dispatch.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_taskdeps.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_lock.cpp.o: reference to __gxx_personality_v0
trace-symbol: runtime/src/CMakeFiles/omp.dir/kmp_ftn_extra.cpp.o: reference to __gxx_personality_v0
trace-symbol: /usr/local/tmp/lto-llvm-333826.o: reference to __gxx_personality_v0
trace-symbol: /usr/local/tmp/lto-llvm-6a93fc.o: reference to __gxx_personality_v0
trace-symbol: /usr/local/tmp/lto-llvm-1fcf52.o: reference to __gxx_personality_v0
trace-symbol: /usr/local/tmp/lto-llvm-1fcf52.o: unresolved symbol __gxx_personality_v0
mold: error: /usr/local/tmp/lto-llvm-1fcf52.o:(.ARM.extab.text._ZL29__kmp_aux_affinity_initializev.llvm.10710035644970803546): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-333826.o:(.ARM.extab.text.omp_set_affinity_format): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-333826.o:(.ARM.extab.text._ZN15ConvertedStringD2Ev): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-6a93fc.o:(.ARM.extab.text.__kmp_api_omp_set_affinity_format_): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-6a93fc.o:(.ARM.extab.text.__kmp_api_omp_display_affinity_): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-6a93fc.o:(.ARM.extab.text.__kmp_api_omp_capture_affinity_): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-1fcf52.o:(.ARM.extab.text._ZN17KMPNativeAffinity13allocate_maskEv): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-333826.o:(.ARM.extab.text.omp_display_affinity): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-1fcf52.o:(.ARM.extab.text._ZN17KMPNativeAffinity19allocate_mask_arrayEi): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-333826.o:(.ARM.extab.text.omp_capture_affinity): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
mold: error: /usr/local/tmp/lto-llvm-1fcf52.o:(.ARM.extab.text._ZL33__kmp_affinity_create_cpuinfo_mapPiP11kmp_i18n_id): R_ARM_PREL31 relocation at offset 0x0 against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
It looks like no one provides a definition of __gxx_personality_v0, which is usually provided by libstdc++.so.
You are using clang as a linker driver. Shouldn't you use clang++ instead?
The cmake options I am passing are as follows:
"cmake -G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_LIBRARY_PATH=/usr/local/lib \
-DCMAKE_C_FLAGS='-O2 -pipe -ffat-lto-objects -fPIC -fuse-ld=mold ' \
-DCMAKE_CXX_FLAGS='-O2 -pipe -ffat-lto-objects -fPIC -fuse-ld=mold ' \
-DCMAKE_EXE_LINKER_FLAGS='' \
-DCMAKE_SHARED_LINKER_FLAGS='' \
-DCMAKE_STATIC_LINKER_FLAGS='' \
-DCMAKE_MODULE_LINKER_FLAGS='' \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=TRUE \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=$(which clang) \
-DCMAKE_C_COMPILER_TARGET=armv7l-cros-linux-gnueabihf \
-DCMAKE_CXX_COMPILER=$(which clang++) \
-DCMAKE_CXX_COMPILER_AR=$(which llvm-ar) \
-DCMAKE_CXX_COMPILER_RANLIB=$(which llvm-ranlib) \
-D_CMAKE_TOOLCHAIN_PREFIX=llvm- \
-DLIBOMP_ENABLE_SHARED=ON \
-DLIBOMP_INSTALL_ALIASES=OFF \
-DOPENMP_LIBDIR_SUFFIX= \
-DPYTHON_EXECUTABLE=$(which python3) \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-Wno-dev \
.."
I don't think we are passing clang as the linker driver intentionally, but replacing -fuse-ld=mold with -fuse-ld=gold` in the above command line lets the compilation succeed.
(Is it possible that cmake is doing something different when it sees mold instead of gold linker here?)
I have no idea, but if ld.gold can link this program, how does it find the definition of __gxx_personality_v0? Are the final link command line arguments identical for mold and gold?
I have no idea, but if ld.gold can link this program, how does it find the definition of
__gxx_personality_v0? Are the final link command line arguments identical for mold and gold?
How do I get the final link arguments for gold?
It looks like you are using Ninja, so just as -v. At the last step, is it still use clang instead of clang++?