Hi, I'm looking for some pointers on how to troubleshoot this problem. I'm trying to write a backend for the AVR. There is an undefined reference at line 48 which is the line FrameInfo() is on. I've tried to use the MSP430 and other targets as references so I'm not sure what changes I did would cause a problem on this line? AVRTargetMachine::AVRTargetMachine(const Target &T, const std::string &TT, const std::string &FS) : LLVMTargetMachine(T, TT), Subtarget(TT, FS), DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"), InstrInfo(Subtarget), TLInfo(*this), FrameInfo(TargetFrameInfo::StackGrowsDown, 1, 0) { } Linking CXX executable ../../bin/llvm-mc cd /home/john/src/llvm_build/tools/llvm-mc && /usr/bin/cmake -E cmake_link_script CMakeFiles/llvm-mc.dir/link.txt --verbose=1 /usr/bin/c++ -g -fPIC CMakeFiles/llvm-mc.dir/llvm-mc.cpp.o CMakeFiles/llvm-mc.dir/AsmExpr.cpp.o CMakeFiles/llvm-mc.dir/AsmLexer.cpp.o CMakeFiles/llvm-mc.dir/AsmParser.cpp.o -o ../../bin/llvm-mc -rdynamic ../../lib/libLLVMAVRCodeGen.a ../../lib/libLLVMAVRAsmPrinter.a ../../lib/libLLVMAVRInfo.a ../../lib/libLLVMMC.a ../../lib/libLLVMSupport.a ../../lib/libLLVMSystem.a -ldl ../../lib/libLLVMSelectionDAG.a ../../lib/libLLVMAnalysis.a ../../lib/libLLVMAsmPrinter.a ../../lib/libLLVMCodeGen.a ../../lib/libLLVMCore.a ../../lib/libLLVMScalarOpts.a ../../lib/libLLVMTransformUtils.a ../../lib/libLLVMSupport.a ../../lib/libLLVMSystem.a ../../lib/libLLVMAVRCodeGen.a(AVRTargetMachine.cpp.o): In function `AVRTargetMachine': /home/john/src/llvm2.6/lib/Target/AVR/AVRTargetMachine.cpp:48: undefined reference to `llvm::TargetData::~TargetData()' /home/john/src/llvm2.6/lib/Target/AVR/AVRTargetMachine.cpp:48: undefined reference to `llvm::TargetData::~TargetData()' ../../lib/libLLVMAVRCodeGen.a(AVRTargetMachine.cpp.o): In function `TargetFrameInfo': /home/john/src/llvm2.6/include/llvm/Target/TargetFrameInfo.h:40: undefined reference to `vtable for llvm::TargetFrameInfo' ../../lib/libLLVMAVRCodeGen.a(AVRTargetMachine.cpp.o): In function `~AVRGenRegisterInfo': /home/john/src/llvm_build/lib/Target/AVR/AVRGenRegisterInfo.h.inc:14: undefined reference to `llvm::TargetRegisterInfo::~TargetRegisterInfo()' ../../lib/libLLVMAVRCodeGen.a(AVRTargetMachine.cpp.o): In function `~TargetInstrInfoImpl': /home/john/src/llvm2.6/include/llvm/Target/TargetInstrInfo.h:474: undefined reference to `llvm::TargetInstrInfo::~TargetInstrInfo()' ../../lib/libLLVMAVRCodeGen.a(AVRTargetMachine.cpp.o): In function `~AVRSubtarget': /home/john/src/llvm2.6/lib/Target/AVR/AVRSubtarget.h:24: undefined reference to `llvm::TargetSubtarget::~TargetSubtarget()' /home/john/src/llvm2.6/lib/Target/AVR/AVRSubtarget.h:24: undefined reference to `llvm::TargetSubtarget::~TargetSubtarget()' ../../lib/libLLVMAVRCodeGen.a(AVRTargetMachine.cpp.o): In function `~LLVMTargetMachine': /home/john/src/llvm2.6/include/llvm/Target/TargetMachine.h:285: undefined reference to `llvm::TargetMachine::~TargetMachine()' ../../lib/libLLVMAVRCodeGen.a(AVRTargetMachine.cpp.o): In function `~AVRTargetMachine': /home/john/src/llvm2.6/lib/Target/AVR/AVRTargetMachine.h:31: undefined reference to `llvm::TargetFrameInfo::~TargetFrameInfo()' /home/john/src/llvm2.6/lib/Target/AVR/AVRTargetMachine.h:31: undefined reference to `llvm::TargetData::~TargetData()' /home/john/src/llvm2.6/lib/Target/AVR/AVRTargetMachine.h:31: undefined reference to `llvm::TargetData::~TargetData()' /home/john/src/llvm2.6/lib/Target/AVR/AVRTargetMachine.h:31: undefined reference to `llvm::TargetFrameInfo::~TargetFrameInfo()' /home/john/src/llvm2.6/lib/Target/AVR/AVRTargetMachine.h:31: undefined reference to `llvm::TargetData::~TargetData()' /home/john/src/llvm2.6/lib/Target/AVR/AVRTargetMachine.h:31: undefined reference to `llvm::TargetData::~TargetData()' -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091101/090a0b87/attachment.html>
Hello, John> There is an undefined reference at line 48 which is the line FrameInfo() is > on. I've tried to use the MSP430 and other targets as references so I'm not > sure > what changes I did would cause a problem on this line?It doesn't seem you're linking libTarget in. Have you tried not to use cmake-generated makefiles? As for the cmake - it tracked the explicit list of dependencies somewhere, you might want to update it as well (and different target-specific places in CMakeList.txt files). -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
John Myers <atomicdog.jwm at gmail.com> writes:> I'm looking for some pointers on how to troubleshoot this problem. I'm > trying to write a backend for the AVR. > There is an undefined reference at line 48 which is the line FrameInfo() is > on. I've tried to use the MSP430 and other targets as references so I'm not > sure > what changes I did would cause a problem on this line?cmake tracks library dependencies on $LLVM_ROOT/cmake/modules/LLVMLibDeps.txt That file is automatically updated on Unix and Unix-like platforms when all LLVM targets are included on the build. This means that either you update the file manually or run the build with MSYS passing -DLLVM_TARGETS_TO_BUILD=all on the cmake command line. The manual update would consist on adding this lines to the above mentioned file: set(MSVC_LIB_DEPS_LLVMAVRAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMAVRInfo LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMAVRCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMAVRInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMAVRInfo LLVMSupport) which uses MSP430 as a template and supposses that your target is named `AVR' (case sensitive). In case you use the automatic update, the first run of the build will fail because the new dependencies are still not effective. Re-execute the build and it should work. -- Óscar
Thanks Anton, that was the problem. I didn't know there was target specific dependencies in the CMake directory. --John On Sun, Nov 1, 2009 at 11:31 PM, Anton Korobeynikov <anton at korobeynikov.info> wrote:> Hello, John > > > There is an undefined reference at line 48 which is the line FrameInfo() > is > > on. I've tried to use the MSP430 and other targets as references so I'm > not > > sure > > what changes I did would cause a problem on this line? > It doesn't seem you're linking libTarget in. Have you tried not to use > cmake-generated makefiles? As for the cmake - it tracked the explicit > list of dependencies somewhere, you might want to update it as well > (and different target-specific places in CMakeList.txt files). > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091102/be6cdcee/attachment.html>
Hi Óscar, Thanks for the explanation. I was able to use the automatic update method. FYI, for some reason the first run build completed without failure. --John On Mon, Nov 2, 2009 at 2:28 AM, Óscar Fuentes <ofv at wanadoo.es> wrote:> The following message is a courtesy copy of an article > that has been posted to gmane.comp.compilers.llvm.devel as well. > > John Myers <atomicdog.jwm at gmail.com> writes: > > > I'm looking for some pointers on how to troubleshoot this problem. I'm > > trying to write a backend for the AVR. > > There is an undefined reference at line 48 which is the line FrameInfo() > is > > on. I've tried to use the MSP430 and other targets as references so I'm > not > > sure > > what changes I did would cause a problem on this line? > > cmake tracks library dependencies on > $LLVM_ROOT/cmake/modules/LLVMLibDeps.txt > > That file is automatically updated on Unix and Unix-like platforms when > all LLVM targets are included on the build. This means that either you > update the file manually or run the build with MSYS passing > -DLLVM_TARGETS_TO_BUILD=all on the cmake command line. > > The manual update would consist on adding this lines to the above > mentioned file: > > set(MSVC_LIB_DEPS_LLVMAVRAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore > LLVMMC LLVMAVRInfo LLVMSupport LLVMSystem LLVMTarget) > set(MSVC_LIB_DEPS_LLVMAVRCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMAVRInfo > LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget) > set(MSVC_LIB_DEPS_LLVMAVRInfo LLVMSupport) > > which uses MSP430 as a template and supposses that your target is named > `AVR' (case sensitive). > > In case you use the automatic update, the first run of the build will > fail because the new dependencies are still not effective. Re-execute > the build and it should work. > > -- > Óscar >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091102/a3e8201f/attachment.html>