This is an archive of the discontinued LLVM Phabricator instance.

[Analysis] Link library dependencies to Analysis plugins
ClosedPublic

Authored by phosek on May 20 2019, 10:53 PM.

Diff Detail

Repository
rC Clang

Event Timeline

phosek created this revision.May 20 2019, 10:53 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 20 2019, 10:53 PM

This is an alternative to D62154. With just the change to HandleLLVMOptions.cmake, we're seeing errors in Analysis plugins due to undefined symbols:

error: 'error' diagnostics seen but not expected:
  (frontend): unable to load plugin './lib/SampleAnalyzerPlugin.so': './lib/SampleAnalyzerPlugin.so: undefined symbol: _ZN4llvm14FoldingSetBase6anchorEv'

and

bin/clang: symbol lookup error: ./lib/SampleAnalyzerPlugin.so: undefined symbol: _ZN5clang4ento15CheckerRegistry10addCheckerEPFvRNS0_14CheckerManagerEEPFbRKNS_11LangOptionsEEN4llvm9StringRefESC_SC_b

I'm not sure where those symbols are supposed to come from, but they're not part of Clang so those errors seem valid. Linking in dependencies unconditionally addresses those failures.

Note that I've been testing this in build of Clang that enables neither shared libraries nor libLLVM.so.

hintonda accepted this revision.May 21 2019, 7:39 AM

LGTM. Build and check-llvm were both clean on my Mac for static build. Thanks!

This revision is now accepted and ready to land.May 21 2019, 7:39 AM
Szelethus accepted this revision.May 21 2019, 2:14 PM
This revision was automatically updated to reflect the committed changes.

This breaks non-PIC builds. Was this planned or expected? Can we revert this until a fix is found?