<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<div>Hi</div><div><br></div><div>I am not a good programmer but for my project i have to use llvm to generate CFG for c programs where i have a mapping from IR instruction in CFG to their respective c instruction. After surfing a in source of llvm i did the following change in printInstruction() function in llvm/lib/VMCore/AsmWriter.cpp file.  </div><div>.....</div><div>void AssemblyWriter::printInstruction(const Instruction &I) {</div><div>  if (AnnotationWriter) AnnotationWriter->emitInstructionAnnot(&I, Out);</div><div><br></div><div>  // Print out indentation for an instruction.</div><div>  Out << "  ";</div><div>        if (MDNode *N = I.getMetadata("dbg")) {  <span class="Apple-tab-span" style="white-space:pre">                  </span>// Code</div><div>   DILocation Loc(N);                                <span class="Apple-tab-span" style="white-space:pre">                       </span>// inserted </div><div>   unsigned Line = Loc.getLineNumber();<span class="Apple-tab-span" style="white-space:pre">                                   </span>// by </div><div>   Out<<"LN@"<<Line;<span class="Apple-tab-span" style="white-space:pre">                                                      </span>// me</div><div>   StringRef File = Loc.getFilename();<span class="Apple-tab-span" style="white-space:pre">                                        </span>// to </div><div>   Out<<"FN@"<<File;<span class="Apple-tab-span" style="white-space:pre">                                                      </span>// get </div><div>   StringRef Dir = Loc.getDirectory();<span class="Apple-tab-span" style="white-space:pre">                                 </span>// the</div><div>   Out<<"DN@"<<Dir;<span class="Apple-tab-span" style="white-space:pre">                                                    </span>// mapping</div><div> }<span class="Apple-tab-span" style="white-space:pre">                                                                    </span>//</div><div><br></div><div>  // Print out name if it exists...</div><div>.....</div><div>Code compiles well but i get following linking problem :(</div><div>llvm[2]: Linking Debug+Asserts executable llvm-as</div><div>/home/rangi/llvm/build/Debug+Asserts/lib/libLLVMCore.a(AsmWriter.o): In function `llvm::DIDescriptor::getUnsignedField(unsigned int) const':</div><div>/home/rangi/llvm/include/llvm/Analysis/DebugInfo.h:70: undefined reference to `llvm::DIDescriptor::getUInt64Field(unsigned int) const'</div><div>/home/rangi/llvm/build/Debug+Asserts/lib/libLLVMCore.a(AsmWriter.o): In function `DIScope':</div><div>/home/rangi/llvm/include/llvm/Analysis/DebugInfo.h:160: undefined reference to `vtable for llvm::DIScope'</div><div>/home/rangi/llvm/build/Debug+Asserts/lib/libLLVMCore.a(AsmWriter.o): In function `~DIScope':</div><div>/home/rangi/llvm/include/llvm/Analysis/DebugInfo.h:161: undefined reference to `vtable for llvm::DIScope'</div><div>/home/rangi/llvm/build/Debug+Asserts/lib/libLLVMCore.a(AsmWriter.o): In function `llvm::DILocation::getFilename() const':</div><div>/home/rangi/llvm/include/llvm/Analysis/DebugInfo.h:785: undefined reference to `llvm::DIScope::getFilename() const'</div><div>/home/rangi/llvm/build/Debug+Asserts/lib/libLLVMCore.a(AsmWriter.o): In function `llvm::DILocation::getDirectory() const':</div><div>/home/rangi/llvm/include/llvm/Analysis/DebugInfo.h:786: undefined reference to `llvm::DIScope::getDirectory() const'</div><div>/home/rangi/llvm/build/Debug+Asserts/lib/libLLVMCore.a(AsmWriter.o): In function `llvm::DIScope llvm::DIDescriptor::getFieldAs<llvm::DIScope>(unsigned int) const':</div><div>/home/rangi/llvm/include/llvm/Analysis/DebugInfo.h:77: undefined reference to `llvm::DIDescriptor::getDescriptorField(unsigned int) const'</div><div><br></div><div>Plese tell me if what is missing and if this the right way to achive mapping.</div><div>Thanks in advance </div><div>Patreek</div>                                      </div></body>
</html>