This is an archive of the discontinued LLVM Phabricator instance.

[polly][unittests] Link DeLICMTests with libLLVMCore
ClosedPublic

Authored by ro on Jan 28 2022, 4:27 AM.

Details

Summary

A -DBUILD_SHARED_LIBS=ON build on Solaris/amd64 failed with

Undefined                       first referenced
 symbol                             in file
_ZNK4llvm3cfg6UpdateIPNS_10BasicBlockEE4dumpEv tools/polly/unittests/DeLICM/CMakeFiles/DeLICMTests.dir/DeLICMTest.cpp.o  (symbol belongs to implicit dependency /var/llvm/local-amd64-release-stage2-shared-A/bin/../lib/libLLVMCore.so.14git)
ld: fatal: symbol referencing errors

Solaris ld requires to directly link with dependant libraries, so this patch explicitly adds
libLLVMCore.

Tested on amd64-pc-solaris2.11 and x86_64-pc-linux-gnu.

Diff Detail

Event Timeline

ro created this revision.Jan 28 2022, 4:27 AM
ro requested review of this revision.Jan 28 2022, 4:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 28 2022, 4:27 AM

DeLICMTests, like all the unittests indeed requires LLVMCore, but I would have assumed it is resolved as transitive dependency by cmake, or at least llvm_config inside add_polly_unittest.

On Linux/x86_64, this configuration ist tested by https://lab.llvm.org/buildbot/#/builders/207 which does not show this issue. Are "implicit dependencies" something Solaris-specific?

polly/unittests/DeLICM/CMakeLists.txt
1

Before I accept the patch, could you add a comment saying why this is needed?

ro added a comment.Jan 28 2022, 5:49 AM

DeLICMTests, like all the unittests indeed requires LLVMCore, but I would have assumed it is resolved as transitive dependency by cmake, or at least llvm_config inside add_polly_unittest.

On Linux/x86_64, this configuration ist tested by https://lab.llvm.org/buildbot/#/builders/207 which does not show this issue. Are "implicit dependencies" something Solaris-specific?

This only happens on Solaris with -DBUILD_SHARED_LIBS=ON, which is OFF by default. I guess this requirement is Solaris-specific, yes. In a way, it makes sense: imagine the direct dependeny (which currently depends on libLLVMCore) drops that dependency in the future (not likely in this case, but well possible in general). Then the executable would suddenly fail to run, which cannot happen if you make the dependency explicit.

This instance is the only case of this problem in the whole tree (well, the parts I do build on Solaris).

polly/unittests/DeLICM/CMakeLists.txt
1

Sure, will do.

ro updated this revision to Diff 403986.Jan 28 2022, 5:52 AM

Add comment.

ro marked an inline comment as done.Jan 28 2022, 5:53 AM
Meinersbur accepted this revision.Jan 28 2022, 8:38 AM

LGTM, thank you.

This revision is now accepted and ready to land.Jan 28 2022, 8:38 AM
This revision was automatically updated to reflect the committed changes.