<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=gb18030" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks, Shu,<br>
<br>
I guess I haven't updated since my post went out.<br>
There are actually 2 problems:<br>
<br>
1. mis-compilation:<br>
My LLVM-2.5 turned out to be mis-compiled using gcc-4.4.0 (surprise to
me) on Debian4-32b.<br>
I tried a few different compilers, and gcc-4.0.4 (a relatively old one,
again surprised me) seems to work out fine.<br>
<br>
Question: is there a good/quick/reliable way to figure out whether a
certain gcc compiler will mis-compile?<br>
<br>
2. I ran into exactly the problem you pointed out. (Thank you)<br>
The Makefile needs some update (after careful comparison between the
tutorial Makefile and the makefile used for lib/Transformation/Hello),
by<br>
commenting out the following line:<br>
<br>
#LLVMLIBS = LLVMCore.a LLVMSystem.a LLVMSupport.a<br>
<br>
I guess the tutorial needs some update, as with release 2.5 things
might have changed a bit.<br>
<br>
Thanks for the reply<br>
<br>
<br>
Chuck<br>
<br>
<br>
Shuguang Feng wrote:
<blockquote
cite="mid:bc3be3bb-643d-4dcd-b9fa-afd3624839d3@b15g2000yqd.googlegroups.com"
type="cite">
<pre wrap="">Hey Chuck,
I'm afraid I can't reproduce your error but...a problem you may run
into later is that opt will complain with
opt: llvm/lib/VMCore/Pass.cpp:149:
void<unnamed>::PassRegistrar::RegisterPass(const llvm::PassInfo&):
Assertion `Inserted && "Pass registered multiple times!"' failed.
Aborted
I "fixed" this by replacing the LLVMLIBS line in the Makefile with
LINK_COMPONENTS according to this tutorial <a class="moz-txt-link-freetext" href="http://llvm.org/docs/MakefileGuide.html#LoadableModules">http://llvm.org/docs/MakefileGuide.html#LoadableModules</a>
and was able to build/run my pass properly.
-shu
On Jul 17, 11:48燼m, Chuck Zhao <a class="moz-txt-link-rfc2396E" href="mailto:cz...@eecg.toronto.edu"><cz...@eecg.toronto.edu></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">While learning to write LLVM passes and following the precise
instructions underhttp://llvm.org/docs/WritingAnLLVMPass.html,
<a class="moz-txt-link-rfc2396E" href="http://llvm.org/docs/WritingAnLLVMPass.html"><http://llvm.org/docs/WritingAnLLVMPass.html></a>
I got this error when loading the hello pass to run the test program:
opt -load ./Release/lib/Hello.so -hello < test/test.bc > /dev/null
Error opening './Release/lib/Hello.so': ./Release/lib/Hello.so:
undefined symbol:
_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i
-load request ignored.
opt: Unknown command line argument '-hello'. 燭ry: 'opt --help'
make: *** [run_lib] Error 1
I think I might have missed a LLVM lib file, but can't figure out which.
I double checked the Makefile, it does have the libLLVMCore.a,
libLLVMSystem.a and libLLVMSupport.a specified.
Could people suggest?
All are based on the LLVM release, running on Debian4-i386.
Thank you very much
Chuck
Hello.cpp file:
#include "llvm/Pass.h"
#include "llvm/Function.h"
using namespace llvm;
namespace {
struct Hello : public FunctionPass {
static char ID;
Hello() : FunctionPass(&ID) {}
virtual bool runOnFunction(Function &F) {
llvm::cerr << "Hello: " << F.getName() << "\n";
return false;
}
};
char Hello::ID = 0;
RegisterPass<Hello> X("hello", "Hello World Pass");
}
Makefile:
# Makefile for hello pass
# Path to top level of LLVM heirarchy
LEVEL = .
# Name of the library to build
LIBRARYNAME = Hello
# Make the shared library become a loadable module so the tools can
# dlopen/dlsym on the resulting library.
LOADABLE_MODULE = 1
# Tell the build system which LLVM libraries your pass needs. You'll
probably
# need at least LLVMSystem.a, LLVMSupport.a, LLVMCore.a but possibly several
# others too.
LLVMLIBS = LLVMCore.a LLVMSupport.a LLVMSystem.a
# Include the makefile implementation stuff
include $(LEVEL)/Makefile.common
_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVM...@cs.uiuc.edu">LLVM...@cs.uiuc.edu</a> 爃ttp://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
</pre>
</blockquote>
<pre wrap=""><!---->
_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</body>
</html>