Hi Mehdi, I meant when I build the LLVM and it will give the following errors: make[2]: Entering directory `/home/alex/new/llvm-obj/tools/llc' llvm[2]: Linking Debug+Asserts executable llc /home/alex/new/llvm-obj/Debug+Asserts/lib/libLLVMCodeGen.a(Passes.o): In function `llvm::TargetPassConfig::addIRPasses()': /home/alex/new/llvm-3.1.src/lib/CodeGen/Passes.cpp:295: undefined reference to `llvm::createMyAliasAnalysisPass()' collect2: ld returned 1 exit status make[2]: *** [/home/alex/new/llvm-obj/Debug+Asserts/bin/llc] Error 1 make[2]: Leaving directory `/home/alex/new/llvm-obj/tools/llc' make[1]: *** [llc/.makeall] Error 2 make[1]: Leaving directory `/home/alex/new/llvm-obj/tools' make: *** [all] Error 1 Thanks, Alex On Fri, Dec 4, 2015 at 5:17 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:> > > On Dec 4, 2015, at 1:37 PM, Alex S via llvm-dev <llvm-dev at lists.llvm.org> > wrote: > > > > Hi all, > > > > I create a folder containing my new alias analysis pass in the > lib/Analysis folder of the source tree. > > I mimic the way IPA did to create a LLVMipa.a library. That is, I write > a Makefile to create my library > > and I change the Makefile correspondingly in the Analysis folder. > > > > However, when I want to use my new alias analysis in the Codegen. The > compiler will complain > > "undefined error" during the link phase. Could anyone point me out > where I need to change in order > > to use my new alias analysis pass in the Codegen? > > > Can you provide the link command that fails and the output? > > > Mehdi > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151204/c33b0c21/attachment.html>
> On Dec 4, 2015, at 2:36 PM, Alex S <alexmountain13 at gmail.com> wrote: > > Hi Mehdi, > > I meant when I build the LLVM and it will give the following errors: > > make[2]: Entering directory `/home/alex/new/llvm-obj/tools/llc' > llvm[2]: Linking Debug+Asserts executable llc > /home/alex/new/llvm-obj/Debug+Asserts/lib/libLLVMCodeGen.a(Passes.o): In function `llvm::TargetPassConfig::addIRPasses()': > /home/alex/new/llvm-3.1.src/lib/CodeGen/Passes.cpp:295: undefined reference to `llvm::createMyAliasAnalysisPass()' > collect2: ld returned 1 exit status > make[2]: *** [/home/alex/new/llvm-obj/Debug+Asserts/bin/llc] Error 1 > make[2]: Leaving directory `/home/alex/new/llvm-obj/tools/llc' > make[1]: *** [llc/.makeall] Error 2 > make[1]: Leaving directory `/home/alex/new/llvm-obj/tools' > make: *** [all] Error 1Since you created a new library, you need to add it as a dependency wherever you’re calling into it: see lib/CodeGen/LLVMBuild.txt Also, on a side note, the Makefile/autotools build is deprecated, you may want to look at cmake. — Mehdi> > > Thanks, > Alex > > > On Fri, Dec 4, 2015 at 5:17 PM, Mehdi Amini <mehdi.amini at apple.com <mailto:mehdi.amini at apple.com>> wrote: > > > On Dec 4, 2015, at 1:37 PM, Alex S via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > > > > Hi all, > > > > I create a folder containing my new alias analysis pass in the lib/Analysis folder of the source tree. > > I mimic the way IPA did to create a LLVMipa.a library. That is, I write a Makefile to create my library > > and I change the Makefile correspondingly in the Analysis folder. > > > > However, when I want to use my new alias analysis in the Codegen. The compiler will complain > > "undefined error" during the link phase. Could anyone point me out where I need to change in order > > to use my new alias analysis pass in the Codegen? > > > Can you provide the link command that fails and the output? > > > Mehdi > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151204/d1f5fd44/attachment.html>
Thanks a lot! Mehdi. I tried to change the LLVMBuild.txt. However, it doesn't help under Makefile/autotools. I will try cmake to rebuild the system again. Thanks again, Alex On Fri, Dec 4, 2015 at 5:50 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:> > On Dec 4, 2015, at 2:36 PM, Alex S <alexmountain13 at gmail.com> wrote: > > Hi Mehdi, > > I meant when I build the LLVM and it will give the following errors: > > make[2]: Entering directory `/home/alex/new/llvm-obj/tools/llc' > llvm[2]: Linking Debug+Asserts executable llc > /home/alex/new/llvm-obj/Debug+Asserts/lib/libLLVMCodeGen.a(Passes.o): In > function `llvm::TargetPassConfig::addIRPasses()': > /home/alex/new/llvm-3.1.src/lib/CodeGen/Passes.cpp:295: undefined > reference to `llvm::createMyAliasAnalysisPass()' > collect2: ld returned 1 exit status > make[2]: *** [/home/alex/new/llvm-obj/Debug+Asserts/bin/llc] Error 1 > make[2]: Leaving directory `/home/alex/new/llvm-obj/tools/llc' > make[1]: *** [llc/.makeall] Error 2 > make[1]: Leaving directory `/home/alex/new/llvm-obj/tools' > make: *** [all] Error 1 > > > Since you created a new library, you need to add it as a dependency > wherever you’re calling into it: see lib/CodeGen/LLVMBuild.txt > > Also, on a side note, the Makefile/autotools build is deprecated, you may > want to look at cmake. > > — > Mehdi > > > > Thanks, > Alex > > > On Fri, Dec 4, 2015 at 5:17 PM, Mehdi Amini <mehdi.amini at apple.com> wrote: > >> >> > On Dec 4, 2015, at 1:37 PM, Alex S via llvm-dev < >> llvm-dev at lists.llvm.org> wrote: >> > >> > Hi all, >> > >> > I create a folder containing my new alias analysis pass in the >> lib/Analysis folder of the source tree. >> > I mimic the way IPA did to create a LLVMipa.a library. That is, I write >> a Makefile to create my library >> > and I change the Makefile correspondingly in the Analysis folder. >> > >> > However, when I want to use my new alias analysis in the Codegen. The >> compiler will complain >> > "undefined error" during the link phase. Could anyone point me out >> where I need to change in order >> > to use my new alias analysis pass in the Codegen? >> >> >> Can you provide the link command that fails and the output? >> >> >> Mehdi >> >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151204/a87b167b/attachment.html>