LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 26392 - Polly requires additional linkages on darwin
Summary: Polly requires additional linkages on darwin
Status: RESOLVED FIXED
Alias: None
Product: Polly
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: Macintosh MacOS X
: P normal
Assignee: Polly Development Mailinglist
URL:
Keywords:
Depends on:
Blocks: 26059
  Show dependency tree
 
Reported: 2016-01-30 08:37 PST by Jack Howarth
Modified: 2016-02-01 11:20 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
add missing linkages to satisfy darwin linker strictness on undefined weak symbols (395 bytes, patch)
2016-01-30 12:53 PST, Jack Howarth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Howarth 2016-01-30 08:37:43 PST
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).
Comment 1 Jack Howarth 2016-01-30 12:53:02 PST
Created attachment 15766 [details]
add missing linkages to satisfy darwin linker strictness on undefined weak symbols
Comment 2 Jack Howarth 2016-01-30 12:56:41 PST
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.
Comment 3 Jack Howarth 2016-01-30 15:08:28 PST
Also confirmed that the proposed change applied to 3.8 branch also bootstraps and passes the polly test suite without regressions.
Comment 4 Tobias Grosser 2016-01-31 14:27:01 PST
I committed this patch in r259332. This should resolve the issue.

Thanks Jack!
Comment 5 Jack Howarth 2016-01-31 18:58:20 PST
(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
Comment 6 Jack Howarth 2016-02-01 11:20:00 PST
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.