The Polly shared library requires additional linkages on darwin. The current linkage in lib/CMakeLists.txt is limited to.... if (BUILD_SHARED_LIBS) target_link_libraries(Polly LLVMSupport LLVMCore LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMAnalysis LLVMipo LLVMMC ) link_directories( ${LLVM_LIBRARY_DIR} ) endif() However darwin requires the additional linkages of... LLVMBitReader LLVMMCParser LLVMObject LLVMProfileData LLVMTarget LLVMVectorize as the darwin requires all of the weak undefined symbols in a library to be resolved when linking it against an executable (unless -Wl,-undefined,dynamic_lookup is used to override the default behavior of -Wl,-undefined,error).
Created attachment 15766 [details] add missing linkages to satisfy darwin linker strictness on undefined weak symbols
The proposed change of... Index: lib/CMakeLists.txt =================================================================== --- lib/CMakeLists.txt (revision 259304) +++ lib/CMakeLists.txt (working copy) @@ -66,6 +66,12 @@ LLVMAnalysis LLVMipo LLVMMC + LLVMBitReader + LLVMMCParser + LLVMObject + LLVMProfileData + LLVMTarget + LLVMVectorize ) link_directories( ${LLVM_LIBRARY_DIR} bootstraps fine on x86_64-apple-darwin15 using current trunk built with -DBUILD_SHARED_LIBS:BOOL=ON and passes the polly test suite. Testing Time: 15.90s Expected Passes : 572 Expected Failures : 17 Unsupported Tests : 7 [100%] Built target check-polly The same change is also needed in 3.8 branch.
Also confirmed that the proposed change applied to 3.8 branch also bootstraps and passes the polly test suite without regressions.
I committed this patch in r259332. This should resolve the issue. Thanks Jack!
(In reply to comment #4) > I committed this patch in r259332. This should resolve the issue. > > Thanks Jack! Confirmed that current trunk now passes the Polly test suite when built on darwin with -DBUILD_SHARED_LIBS:BOOL=ON. Testing Time: 8.86s Expected Passes : 572 Expected Failures : 17 Unsupported Tests : 7 [100%] Built target check-polly
Can you please back port r259332 to 3.8 branch? It would eliminate the need for any patching of polly on darwin. Thanks in advance.