Robert L. Bocchino Jr.
2006-Jan-06 22:53 UTC
[LLVMdev] Dynamically loaded passes under OS X
When I tried this a while back, the .so file wasn't being built on Mac OS X. Now it looks like it is. I got dynamic loading to work following the instructions in http://llvm.cs.uiuc.edu/docs/ WritingAnLLVMPass.html. However, there was a typo in the instructions (it should say LOADABLE_MODULE = 1), and I fixed that and committed it. I also fixed the sample/lib/sample Makefile to conform to these instructions. So problem solved, thanks. Rob On Jan 6, 2006, at 3:29 PM, Reid Spencer wrote:> The answer lies in the lib/System/ltdl.c which is the dynamic loader > used by LLVM for cross platform dynamic loading. If there are > paths or > files that we're not looking for on OS/X then that needs to be fixed. > Could you be a little more specific about what failures you are > experiencing? > > Reid. > > On Fri, 2006-01-06 at 14:25 -0600, Robert L. Bocchino Jr. wrote: >> Hi, >> >> >> In the past, I haven't been able to get dynamically loaded passes to >> work under OS X. When I follow the instructions in the LLVM >> documentation, everything works fine for Linux, but OS X has a >> different way of handling dynamic loading, and the files that the >> dynamic loader is trained to look for don't exist. In the past, I've >> worked around this by just linking all my passes into opt, but this >> isn't going to work for me anymore. >> >> >> So how do I get dynamically loaded passes to work on the Mac? Chris, >> you probably know the answer to this since you're a Mac user now. >> >> >> Rob >> >> >> >> Robert L. Bocchino Jr. >> >> Ph.D. Student >> >> University of Illinois, Urbana-Champaign >> >> >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdevRobert L. Bocchino Jr. Ph.D. Student, Computer Science University of Illinois, Urbana-Champaign -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060106/d5f552cf/attachment.html>
Here's why I was questioning the change to sample/lib/sample Makefile: make[4]: Entering directory `/proj/llvm/build/projects/sample/lib/sample' llvm[4]: Compiling sample.c for Debug build (PIC) llvm[4]: Linking Debug Shared Library sample.so llvm[4]: Linking Debug Object Library sample.o /proj/install/lib/libstdc++.a: member /proj/install/lib/libstdc++.a (allocator-inst.o) in archive is not an object collect2: ld returned 1 exit status make[4]: *** [/proj/llvm/build/projects/sample/Debug/lib/sample.la] Error 1 Reid. On Fri, 2006-01-06 at 16:53 -0600, Robert L. Bocchino Jr. wrote:> When I tried this a while back, the .so file wasn't being built on Mac > OS X. Now it looks like it is. I got dynamic loading to work > following the instructions > in http://llvm.cs.uiuc.edu/docs/WritingAnLLVMPass.html. However, > there was a typo in the instructions (it should say LOADABLE_MODULE > 1), and I fixed that and committed it. I also fixed the > sample/lib/sample Makefile to conform to these instructions. > > > So problem solved, thanks. > > > Rob > > On Jan 6, 2006, at 3:29 PM, Reid Spencer wrote: > > > The answer lies in the lib/System/ltdl.c which is the dynamic loader > > used by LLVM for cross platform dynamic loading. If there are paths > > or > > files that we're not looking for on OS/X then that needs to be > > fixed. > > Could you be a little more specific about what failures you are > > experiencing? > > > > > > Reid. > > > > > > On Fri, 2006-01-06 at 14:25 -0600, Robert L. Bocchino Jr. wrote: > > > Hi, > > > > > > > > > > > > > > > In the past, I haven't been able to get dynamically loaded passes > > > to > > > work under OS X. When I follow the instructions in the LLVM > > > documentation, everything works fine for Linux, but OS X has a > > > different way of handling dynamic loading, and the files that the > > > dynamic loader is trained to look for don't exist. In the past, > > > I've > > > worked around this by just linking all my passes into opt, but > > > this > > > isn't going to work for me anymore. > > > > > > > > > > > > > > > So how do I get dynamically loaded passes to work on the Mac? > > > Chris, > > > you probably know the answer to this since you're a Mac user now. > > > > > > > > > > > > > > > Rob > > > > > > > > > > > > > > > > > > > > > Robert L. Bocchino Jr. > > > > > > > > > Ph.D. Student > > > > > > > > > University of Illinois, Urbana-Champaign > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > LLVM Developers mailing list > > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > Robert L. Bocchino Jr. > > Ph.D. Student, Computer Science > > University of Illinois, Urbana-Champaign > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060108/c89b6b1f/attachment.sig>
Robert L. Bocchino Jr.
2006-Jan-08 23:07 UTC
[LLVMdev] Dynamically loaded passes under OS X
I believe that prior to the change the Makefile wasn't building a dynamic library (even though the comment said it was). The way it is now works on Persephone (the Mac) at UIUC. Without saying LOADABLE_MODULE = 1 I got an error on Persephone similar to what you report here. Is the problem possibly that the Makefile needs to be different for the different platforms? Rob On Sunday, January 8, 2006, at 04:55 PM, Reid Spencer wrote:> Here's why I was questioning the change to sample/lib/sample Makefile: > > make[4]: Entering directory > `/proj/llvm/build/projects/sample/lib/sample' > llvm[4]: Compiling sample.c for Debug build (PIC) > llvm[4]: Linking Debug Shared Library sample.so > llvm[4]: Linking Debug Object Library sample.o > /proj/install/lib/libstdc++.a: member /proj/install/lib/libstdc++.a > (allocator-inst.o) in archive is not an object > collect2: ld returned 1 exit status > make[4]: *** [/proj/llvm/build/projects/sample/Debug/lib/sample.la] > Error 1 > > Reid. > > On Fri, 2006-01-06 at 16:53 -0600, Robert L. Bocchino Jr. wrote: >> When I tried this a while back, the .so file wasn't being built on Mac >> OS X. Now it looks like it is. I got dynamic loading to work >> following the instructions >> in http://llvm.cs.uiuc.edu/docs/WritingAnLLVMPass.html. However, >> there was a typo in the instructions (it should say LOADABLE_MODULE >> 1), and I fixed that and committed it. I also fixed the >> sample/lib/sample Makefile to conform to these instructions. >> >> >> So problem solved, thanks. >> >> >> Rob >> >> On Jan 6, 2006, at 3:29 PM, Reid Spencer wrote: >> >>> The answer lies in the lib/System/ltdl.c which is the dynamic loader >>> used by LLVM for cross platform dynamic loading. If there are paths >>> or >>> files that we're not looking for on OS/X then that needs to be >>> fixed. >>> Could you be a little more specific about what failures you are >>> experiencing? >>> >>> >>> Reid. >>> >>> >>> On Fri, 2006-01-06 at 14:25 -0600, Robert L. Bocchino Jr. wrote: >>>> Hi, >>>> >>>> >>>> >>>> >>>> In the past, I haven't been able to get dynamically loaded passes >>>> to >>>> work under OS X. When I follow the instructions in the LLVM >>>> documentation, everything works fine for Linux, but OS X has a >>>> different way of handling dynamic loading, and the files that the >>>> dynamic loader is trained to look for don't exist. In the past, >>>> I've >>>> worked around this by just linking all my passes into opt, but >>>> this >>>> isn't going to work for me anymore. >>>> >>>> >>>> >>>> >>>> So how do I get dynamically loaded passes to work on the Mac? >>>> Chris, >>>> you probably know the answer to this since you're a Mac user now. >>>> >>>> >>>> >>>> >>>> Rob >>>> >>>> >>>> >>>> >>>> >>>> >>>> Robert L. Bocchino Jr. >>>> >>>> >>>> Ph.D. Student >>>> >>>> >>>> University of Illinois, Urbana-Champaign >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> LLVM Developers mailing list >>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >> >> Robert L. Bocchino Jr. >> >> Ph.D. Student, Computer Science >> >> University of Illinois, Urbana-Champaign >> >> >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > <signature.asc>_______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >Robert L. Bocchino Jr. 1950 South Orchard St., Apt. A Urbana, IL 61801 (217) 979-1053