<div dir="ltr"><div><div>Thanks Nakamura, that was actually a nice hint.<br>I added the follow lines (copied from ARMAsmParser.cpp) to the end of my TestAsmParser.cpp file and it seems like the problem is solved during the compilation time, though I haven't tested it yet to see if the binary works as well!<br><br>#define GET_REGISTER_MATCHER<br>#define GET_SUBTARGET_FEATURE_NAME<br>#define GET_MATCHER_IMPLEMENTATION<br>#include "TestGenAsmMatcher.inc"<br><br></div>Cheers,<br></div>ES<br><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 20, 2015 at 10:26 AM, Sky Flyer <span dir="ltr"><<a href="mailto:skylake007@googlemail.com" target="_blank">skylake007@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Nakamura,<br><br>I have already added the following lines to the TestAsmParser class:<br><br>#define GET_ASSEMBLER_HEADER<br>#include "TestGenAsmMatcher.inc"<br><br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 20, 2015 at 9:52 AM, NAKAMURA Takumi <span dir="ltr"><<a href="mailto:geek4civic@gmail.com" target="_blank">geek4civic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Did you include and instantiate TestGenAsmMatcher.inc ?</div><br><div class="gmail_quote"><div><div><div dir="ltr">On Thu, Aug 20, 2015 at 2:46 PM Sky Flyer via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div>Hi all,<br><br>I am trying to compile with a minimal TestAsmParser class, but I get the following error.<br><br>----------------<br><br>[43/780] Linking CXX executable bin/llvm-mc<br>FAILED: : && /usr/bin/c++   -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -g  -Wl,-allow-shlib-undefined    -Wl,-O3 -Wl,--gc-sections tools/llvm-mc/CMakeFiles/llvm-mc.dir/llvm-mc.cpp.o tools/llvm-mc/CMakeFiles/llvm-mc.dir/Disassembler.cpp.o  -o bin/llvm-mc lib/libLLVMTestCodeGen.a lib/libLLVMTestAsmPrinter.a lib/libLLVMTestAsmParser.a lib/libLLVMTestDesc.a lib/libLLVMTestInfo.a lib/libLLVMMC.a lib/libLLVMMCParser.a lib/libLLVMSupport.a lib/libLLVMAsmPrinter.a lib/libLLVMSelectionDAG.a lib/libLLVMCodeGen.a lib/libLLVMScalarOpts.a lib/libLLVMInstCombine.a lib/libLLVMProfileData.a lib/libLLVMObject.a lib/libLLVMBitReader.a lib/libLLVMTransformUtils.a lib/libLLVMipa.a lib/libLLVMAnalysis.a lib/libLLVMTarget.a lib/libLLVMCore.a lib/libLLVMTestAsmPrinter.a lib/libLLVMMCParser.a lib/libLLVMMC.a lib/libLLVMSupport.a -lrt -ldl -ltinfo -lpthread -lz -lm -Wl,-rpath,"\$ORIGIN/../lib" && :<br>lib/libLLVMTestAsmParser.a(TestAsmParser.cpp.o): In function `TestAsmParser':<br>/llvm/lib/Target/Test/AsmParser/TestAsmParser.cpp:96: <b>undefined reference to `vtable for (anonymous namespace)::TestAsmParser'</b><br>/llvm/lib/Target/Test/AsmParser/TestAsmParser.cpp:99: <b>undefined reference to `(anonymous namespace)::TestAsmParser::ComputeAvailableFeatures(unsigned long) const'</b><br>collect2: error: ld returned 1 exit status<br><br><br>----------------<br></div><div>and here is the code that it refers to:<br><br>  TestAsmParser(MCSubtargetInfo &sti, MCAsmParser &parser,<br>               const MCInstrInfo &MII, const MCTargetOptions &Options)<br>    : MCTargetAsmParser(), STI(sti), Parser(parser) {<br><br>    // Initialize the set of available features.<br>    setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));<br>  }<br></div><div><br><br><br>Destructors for both TestAsmParser and MCTargetAsmParser class are available.<br>I am using CMake.<br><br>I added the following lines to AsmParser/CMakeLists.txt (From the Assembler Guide by Simon Cook from Embecosm <a href="http://www.embecosm.com/appnotes/ean10/ean10-howto-llvmas-1.0.pdf" target="_blank">Link</a>)<br><br><i>add_llvm_library(LLVMTestAsmParser<br>  TestAsmParser.cpp<br>  )</i><br><br>and the followings to main CMakeLists.txt<br><br><i>tablegen(LLVM TestGenAsmMatcher.inc -gen-asm-matcher)<br>add_subdirectory(AsmParser)</i><br><br>Any help is appreciated.<br><br></div><div>Cheers,<br></div><div>ES<br></div></div></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>