runtime: [Alpine.38.Arm64] gCurrentThreadInfo: symbol not found

Checked coreclr fails to run on Alpine 3.8 (Arm64)

+ /root/helix/work/correlation/corerun /root/helix/work/correlation/xunit.console.dll baseservices.compilerservices.XUnitWrapper.dll -parallel collections -nocolor -noshadow -xml testResults.xml -notrait 'category=outerloop' -notrait 'category=failing'
dlopen failed to open the libcoreclr.so with error Error relocating /root/helix/work/correlation/libcoreclr.so: gCurrentThreadInfo: symbol not found

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 19 (19 by maintainers)

Most upvoted comments

I’ve spent quite some time today investigating the issue. I’ve tried:

  • use the binutils built from the https://github.com/richfelker/musl-cross-make repo
  • use the binutils 2.31.1 built with additional options that I’ve found being used during binutils-gold package build in the Alpine repo
  • add “-z now -z relro” options to clang linker options (as the clang in Alpine repo is built with those set by default and they may influence how symbols are linked)
  • tried using clang-7
  • revert change that we’ve made recently that set the default symbol visibility to hidden

Nothing worked, the issue persists.

The only thing that fixes the problem is to not to use the ld.gold and use the regular ld instead. In fact, we should not be using the ld.gold as we don’t have PGO data available for Linux musl arm64 and we turn on the ld.gold only when we have the PGO data available. The reason we use it with PGO is that only the ld.gold can consume these data. The cross build, as opposed to the native build, uses ld.gold by default due to a bug in cross/toolchain.cmake that unnecessarily sets ld.gold as the linker to use. I’ve tried to force the usage of ld.gold when building natively on arm64 device - and the missing symbols appeared. So the reason why the native build worked was that it is using ld instead of ld.gold and the issue is not caused by the cross building.

Finally, I’ve tried to use clang-7 with the new llvm linker called lld. That linker should also be capable of using the PGO data, so it could replace the ld.gold if we moved to clang-7 and using the lld helped. And that worked too - no missing symbols.

My suggestion to fix the issue for the preview 5 is to remove the incorrect unconditional setting of ld.gold as a linker from cross/toolchain.cmake. Then at some point after the preview 5 release, we should consider moving to clang-7 and the LLVM lld linker so that we can use PGO.

I can confirm that the cross build with the updated binutils works. There are no missing symbols.

I’ve noticed an additional problem with the way we build the binutils. We were building them without plugin support, so the LTO was turned off. It is just a matter of adding the --enable-plugins=yes option to the configure command line when building binutils.