[llvm-dev] Problem Compiling AsmParser

Sky Flyer via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 19 22:46:21 PDT 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150820/0a76e730/attachment.html>


More information about the llvm-dev mailing list