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

2016-03-30 Thread Stefan Kemnitz via cfe-commits
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



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-03-31 Thread Stefan Kemnitz via cfe-commits
realincubus added a comment.

would it be possible to add some cmake flag that would allow the user to choose 
whether to respect the libclang.exports file or not ?


http://reviews.llvm.org/D15729



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-01-12 Thread Stefan Kemnitz via cfe-commits
realincubus added a comment.

Hi.

I am finally back at work and happy to see that some effort already went into 
the patch that i initially wrote some time ago (http://reviews.llvm.org/D5611)

I just looked through the files of the new patch and noticed that the 
libclang.exports file is missing.
As far as i understand this, the exports file defines which symbols will be 
visible to the linker when linking to the 
libclang.so library.

Since some of the symbols that are needed for the plugin mechanism to work are 
not exported, i wrote a list of these symbols and appended theses to the 
libclang.exports file.

**If i don't add these symbols it's impossible to load any plugin from 
libclang.so **

I assume that if you write a test for loading plugins via libclang you should 
write a test that acually uses libclang for loading plugins via its C interface 
(clang_parseTranslationUnit).

@kfunk you said that this works for you without the additional symbols. it 
might be that something changed in clangs codebase and i dont have to export 
the symbols anymore. In the following days i will try to run my code without 
the symbols and write a test that uses libclangs C interface.

all the best stefan kemnitz


http://reviews.llvm.org/D15729



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-01-15 Thread Stefan Kemnitz via cfe-commits
realincubus added a comment.

ok after i checked out a recent version of clang and applied the patch 
http://reviews.llvm.org/D15729 i can verify, that one does not have to add the 
symbols to the libclang.exports file.

i believe the plugin mechanism was changed between the first version of my 
plugin and how it works right now.
i will now try to find out why the test doesn't work like it should or write 
another one.


http://reviews.llvm.org/D15729



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits