[PATCH] D140637: [InlineOrder] Plugin Inline Order

Theodoros Theodoridis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 23 10:06:13 PDT 2023


ttheodor added a comment.

In D140637#4216528 <https://reviews.llvm.org/D140637#4216528>, @tmatheson wrote:

> This test fails when I build and run with the following:
>
>   cmake ../llvm -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON -DLLVM_ENABLE_PLUGINS=ON -DBUILD_SHARED_LIBS=OFF -DLLVM_ENABLE_PROJECTS=clang
>   ninja unittests/Analysis/AnalysisTests
>   ./unittests/Analysis/AnalysisTests --gtest_filter=PluginInlineOrderTest.NoInlineFoo
>
> I get the following failure:
>
>   $ ./unittests/Analysis/AnalysisTests --gtest_filter=PluginInlineOrderTest.NoInlineFoo
>   Note: Google Test filter = PluginInlineOrderTest.NoInlineFoo
>   [==========] Running 1 test from 1 test suite.
>   [----------] Global test environment set-up.
>   [----------] 1 test from PluginInlineOrderTest
>   [ RUN      ] PluginInlineOrderTest.NoInlineFoo
>   /ssd/upstream/llvm/unittests/Analysis/PluginInlineOrderAnalysisTest.cpp:48: Failure
>   Value of: !!Plugin
>     Actual: false
>   Expected: true
>   Plugin path: /ssd/upstream/build2/unittests/Analysis/InlineOrderPlugin.so
>   [  FAILED  ] PluginInlineOrderTest.NoInlineFoo (4 ms)
>   [----------] 1 test from PluginInlineOrderTest (4 ms total)
>   
>   [----------] Global test environment tear-down
>   [==========] 1 test from 1 test suite ran. (4 ms total)
>   [  PASSED  ] 0 tests.
>   [  FAILED  ] 1 test, listed below:
>   [  FAILED  ] PluginInlineOrderTest.NoInlineFoo
>   
>    1 FAILED TEST
>
> The error returned by `CI.setupPlugin()` is `InlineOrderPlugin.so: undefined symbol: _ZN4llvm13AllAnalysesOnINS_6ModuleEE6SetKeyE"`.
>
> This symbol is `llvm::AllAnalysesOn<llvm::Module>::SetKey` defined in LLVMCore. It is present in the unit test executable but is a local symbol:
>
>   $ readelf -s -W ./unittests/Analysis/AnalysisTests | rg _ZN4llvm13AllAnalysesOnINS_6ModuleEE6SetKeyE
>    41264: 0000000001c79738     8 OBJECT  LOCAL  DEFAULT   29 _ZN4llvm13AllAnalysesOnINS_6ModuleEE6SetKeyE
>
> Therefore it is not resolved by the `dlopen`.

With `-DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON` enabled `https://github.com/llvm/llvm-project/blob/main/llvm/utils/extract_symbols.py` is used to determine which symbols should be exported. I believe the issue is here `https://github.com/llvm/llvm-project/blob/main/llvm/utils/extract_symbols.py#L61`:  the `u` symbol type is missing.

  nm -g -P lib/libLLVMCore.a | grep _ZN4llvm13AllAnalysesOnINS_6ModuleEE6SetKeyE                          
  _ZN4llvm13AllAnalysesOnINS_6ModuleEE6SetKeyE u 0 8


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140637



More information about the llvm-commits mailing list