[PATCH] D15729: Load compiler plugins in ASTUnit, too

Stefan Kemnitz via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 30 06:04:14 PDT 2016


realincubus added a comment.

@bkramer I can verify that after building this with clang 3.9 in release mode it does not work anymore like expected. everything is fine in debug mode

if i look at the output generated from

  llvm::sys::DynamicLibrary::LoadLibraryPermanently

in 1761 CompilerInstance::loadPlugins()

i get errors like

  /home/incubus/llvm_patch_test/build/lib/ClangPlugin.so /home/incubus/llvm_patch_test/build/lib/ClangPlugin.so: undefined symbol: _ZN5clang17ASTFrontendAction13ExecuteActionEv

In my original patch http://reviews.llvm.org/D5611 I added a list of symbols that had to be exported in order to make libclang work with plugins like expected.
After adding the symbols from the original patch and 2 additional ones it is ok now with clang version 3.9 in release mode.

Symbols needed:

  _ZN5clang15PluginASTAction6anchorEv
  _ZN4llvm11raw_ostream5writeEPKcm
  _ZN4llvm4errsEv
  _ZN5clang11ASTConsumer33HandleTopLevelDeclInObjCContainerENS_12DeclGroupRefE
  _ZN5clang14FrontendActionD2Ev
  _ZN5clang13DiagnosticIDs15getCustomDiagIDENS0_5LevelEN4llvm9StringRefE
  _ZN5clang17ASTFrontendAction13ExecuteActionEv
  _ZN5clang11ASTConsumer24HandleImplicitImportDeclEPNS_10ImportDeclE
  _ZN5clang14FrontendAction22shouldEraseOutputFilesEv
  _ZNK5clang15DeclarationName11getAsStringEv
  _ZN5clang17DiagnosticsEngine21EmitCurrentDiagnosticEb
  _ZN5clang11ASTConsumer21HandleInterestingDeclENS_12DeclGroupRefE
  _ZN5clang14FrontendActionC2Ev
  _ZN4llvm8RegistryIN5clang15PluginASTActionENS_14RegistryTraitsIS2_EEE4nodeC1ERKNS_19SimpleRegistryEntryIS2_EE
  _ZTVN5clang15PluginASTActionE
  _ZTVN5clang17ASTFrontendActionE
  _ZTVN5clang11ASTConsumerE
  _ZN4llvm8RegistryIN5clang15PluginASTActionEE4HeadE
  _ZN4llvm8RegistryIN5clang15PluginASTActionEE4TailE

Please tell me if I am wrong, but "tools/libclang/libclang.exports" is kind of a filter.
Everything that is not listed in this file is not exported as a symbol in the resulting libclang.so file.

Is there a way to automatically add the needed symbols to the exports file ?


http://reviews.llvm.org/D15729





More information about the cfe-commits mailing list