[LLVMdev] dragonegg polly support broken?

Tobias Grosser
Sun, 21 Oct 2012 18:58:43 -0000

On 10/21/2012 11:46 AM, Jack Howarth wrote:
> On Sun, Oct 21, 2012 at 02:35:49PM -0400, Jack Howarth wrote:
>> On Sun, Oct 21, 2012 at 11:01:37AM -0700, Tobias Grosser wrote:
>>> On 10/21/2012 10:57 AM, Jack Howarth wrote:
>>>> On Sun, Oct 21, 2012 at 10:38:48AM -0700, Tobias Grosser wrote:
>>>>> On 10/21/2012 09:13 AM, Jack Howarth wrote:
>>>>>> On Sun, Oct 21, 2012 at 08:38:21AM -0700, Tobias
Grosser wrote:
>>>>>>> On 10/20/2012 05:38 PM, Jack Howarth wrote:
>>>>>>>> Duncan,
>>>>>>>>         Is the documentation for using Polly
support in dragonegg correct? I built llvm/polly/dragonegg
>>>>>>>> using the documentation at
http://polly.llvm.org/example_load_Polly_into_dragonegg.html
>>>>>>>> with...
>>>>>>>>
>>>>>>>> GCC=/sw/lib/gcc4.7/bin/gcc-4
LLVM_CONFIG=/sw/opt/llvm-3.2/bin/llvm-config ENABLE_LLVM_PLUGINS=1 make
CPPFLAGS="-DENABLE_LTO -I/sw/include"
>>>>>>>>
>>>>>>>> The resulting dragonegg plugin works fine as...
>>>>>>>>
>>>>>>>> /sw/lib/gcc4.7/bin/gcc-4
-fplugin=/sw/lib/gcc4.7/lib/dragonegg.so -O3  himenoBMTxpa.c
>>>>>>>>
>>>>>>>> but if I try to invoke polly with...
>>>>>>>>
>>>>>>>> /sw/lib/gcc4.7/bin/gcc-4
-fplugin=/sw/lib/gcc4.7/lib/dragonegg.so -O3
-fplugin-arg-dragonegg-llvm-option=load:/sw/opt/llvm-3.2/lib/LLVMPolly.dylib
himenoBMTxpa.c
>>>>>>>>
>>>>>>>>
>>>>>>>> I get the error...
>>>>>>>>
>>>>>>>> cc1: Unknown command line argument
'load=/sw/opt/llvm-3.2/lib/LLVMPolly.dylib'.  Try: 'cc1 -help'
>>>>>>>
>>>>>>> I think the website is wrong. You probably need to
add a '-' before the
>>>>>>> 'load'. See the following:
>>>>>>>
>>>>>>>
"-fplugin-arg-dragonegg-llvm-option=-load:/sw/opt/llvm-3.2/lib/LLVMPolly.dylib"
>>>>>>>
>>>>>>> Please let me know if this works, such that I can
update the website.
>>>>>>
>>>>>> Tobias,
>>>>>>       This solves the previous problem but exposes
another...
>>>>>
>>>>> Great, I checked in the website fix in:
>>>>>
>>>>> https://llvm.org/svn/llvm-project/polly/trunk at 166396
>>>>>
>>>>>>
>>>>>> [MacBookPro:~] howarth% /sw/lib/gcc4.7/bin/gcc-4
-fplugin=/sw/lib/gcc4.7/lib/dragonegg.so -O3
-fplugin-arg-dragonegg-llvm-option=-load:/sw/opt/llvm-3.2/lib/LLVMPolly.dylib
himenoBMTxpa.c -v
>>>>>> himenoBMTxpa.c:248:5: warning: incompatible implicit
declaration of built-in function ‘free’ [enabled by default]
>>>>>> dyld: lazy symbol binding failed: fast lazy bind offset
out of range (39257, max=7640) in image
/sw/lib/gcc4.7/libexec/gcc/x86_64-apple-darwin11.4.2/4.7.2/cc1
>>>>>> dyld: fast lazy bind offset out of range (39257,
max=7640) in image
/sw/lib/gcc4.7/libexec/gcc/x86_64-apple-darwin11.4.2/4.7.2/cc1
>>>>>> gcc-4: internal compiler error: Trace/BPT trap: 5
(program cc1)
>>>>>> Please submit a full bug report,
>>>>>> with preprocessed source if appropriate.
>>>>>> See <http://gcc.gnu.org/bugs.html> for
instructions.
>>>>>>
>>>>>> I'll open a bugzilla for this one.
>>>>>
>>>>> Yes, please do. This is an interesting problem. I have no
solution of
>>>>> the top of my head.
>>>>
>>>> Done... http://llvm.org/bugs/show_bug.cgi?id=14140. I'll
ping the MacPorts maintainers of their llvm-3.2 package to update
>>>> it to contain polly as well. This, with a rebuild of their
dragonegg-3.2 package, should provide the Apple programmers with
>>>> pre-built binaries to debug this issue without tainting
themselves with GPLv3 code.
>>>
>>> Thanks.
>>>
>>>> Can you take a look at lvm.org/bugs/show_bug.cgi?id=14135 as
well? We need to avoid using LLVM_SHLIBEXT in the test
>>>> subdirectory because this is defined to '.dylib' on
darwin while Polly correctly builds the loadable module with the
>>>> '.so' suffix causing almost all of the testsuite to
fail with 'make test-polly'. Thanks in advance.
>>>
>>> I would prefer to build Polly with the native extension on darwin.
The
>>> native extension seems to be '.dylib', no? Do you know if a
autoconf
>>> build gets it right?
>>
>> Tobias,
>>     I would note that '.so' is a valid suffix for shared
modules on darwin as witnessed by
>> their use in
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
>> for the python shared modules on both Lion and Mountain Lion. So we
aren't deviating from
>> convention here.
>>          Jack
>
> Also see http://docstore.mik.ua/orelly/unix3/mac/ch05_03.htm which
describes the convention
> for shared modules on darwin as being named with the .bundle or .so suffix.
So the flaw is
> limited to the test subdirectory in polly. Polly correctly produces a
LLVMPolly.so but
> incorrectly tries to test polly with a non-existent LLVMPolly.dylib.

Thanks. I just found the same page.

Does attached patch work for you?

Tobi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-cmake-Use-suffix-for-shared-modules-instead-of-the-o.patch
Type: text/x-patch
Size: 1149 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20121021/14078d7f/attachment.bin>