[llvm-dev] Problem Compiling AsmParser

Sky Flyer via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 20 02:21:38 PDT 2015


Thanks Nakamura, that was actually a nice hint.
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!

#define GET_REGISTER_MATCHER
#define GET_SUBTARGET_FEATURE_NAME
#define GET_MATCHER_IMPLEMENTATION
#include "TestGenAsmMatcher.inc"

Cheers,
ES


On Thu, Aug 20, 2015 at 10:26 AM, Sky Flyer <skylake007 at googlemail.com>
wrote:

> Hi Nakamura,
>
> I have already added the following lines to the TestAsmParser class:
>
> #define GET_ASSEMBLER_HEADER
> #include "TestGenAsmMatcher.inc"
>
>
> On Thu, Aug 20, 2015 at 9:52 AM, NAKAMURA Takumi <geek4civic at gmail.com>
> wrote:
>
>> Did you include and instantiate TestGenAsmMatcher.inc ?
>>
>> On Thu, Aug 20, 2015 at 2:46 PM Sky Flyer via llvm-dev <
>> llvm-dev at lists.llvm.org> wrote:
>>
>>> Hi all,
>>>
>>> I am trying to compile with a minimal TestAsmParser class, but I get the
>>> following error.
>>>
>>> ----------------
>>>
>>> [43/780] Linking CXX executable bin/llvm-mc
>>> 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" && :
>>> lib/libLLVMTestAsmParser.a(TestAsmParser.cpp.o): In function
>>> `TestAsmParser':
>>> /llvm/lib/Target/Test/AsmParser/TestAsmParser.cpp:96: *undefined
>>> reference to `vtable for (anonymous namespace)::TestAsmParser'*
>>> /llvm/lib/Target/Test/AsmParser/TestAsmParser.cpp:99: *undefined
>>> reference to `(anonymous
>>> namespace)::TestAsmParser::ComputeAvailableFeatures(unsigned long) const'*
>>> collect2: error: ld returned 1 exit status
>>>
>>>
>>> ----------------
>>> and here is the code that it refers to:
>>>
>>>   TestAsmParser(MCSubtargetInfo &sti, MCAsmParser &parser,
>>>                const MCInstrInfo &MII, const MCTargetOptions &Options)
>>>     : MCTargetAsmParser(), STI(sti), Parser(parser) {
>>>
>>>     // Initialize the set of available features.
>>>     setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
>>>   }
>>>
>>>
>>>
>>> Destructors for both TestAsmParser and MCTargetAsmParser class are
>>> available.
>>> I am using CMake.
>>>
>>> I added the following lines to AsmParser/CMakeLists.txt (From the
>>> Assembler Guide by Simon Cook from Embecosm Link
>>> <http://www.embecosm.com/appnotes/ean10/ean10-howto-llvmas-1.0.pdf>)
>>>
>>>
>>>
>>> *add_llvm_library(LLVMTestAsmParser  TestAsmParser.cpp  )*
>>>
>>> and the followings to main CMakeLists.txt
>>>
>>>
>>> *tablegen(LLVM TestGenAsmMatcher.inc
>>> -gen-asm-matcher)add_subdirectory(AsmParser)*
>>>
>>> Any help is appreciated.
>>>
>>> Cheers,
>>> ES
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> llvm-dev at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150820/7bd436d9/attachment.html>


More information about the llvm-dev mailing list