[PATCH] D65572: Fix static linking failure with --unwindlib=libunwind

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 4 19:47:06 PDT 2019


MaskRay added a comment.

If libunwind is configured with `-DLIBUNWIND_ENABLE_THREADS=Off` / it is on Windows / `-DLIBUNWIND_USE_WEAK_PTHREAD=On`, libpthread is not a hard dependency.

If you use lld:

  #if _LIBUNWIND_USE_DLADDR
  #include <dlfcn.h>
  #if defined(__unix__) && defined(__ELF__) && defined(_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA)
  #pragma comment(lib, "dl")
  #endif
  #endif
  
  #if defined(__unix__) && !defined(__ANDROID__) && defined(__ELF__) && defined(_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA)
  #pragma comment(lib, "pthread")
  #endif


Repository:
  rC Clang

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

https://reviews.llvm.org/D65572





More information about the cfe-commits mailing list