Hi, I'm a cs326 student that uses LLVM for our MP. While some of the COOL program can be run seamlessly, I get the following assertion error for many of them. lli: Pass.cpp:95: bool llvm::FunctionPassManager::run(llvm::Function&):>> Assertion `(&F == mF) && "ModuleProvider does not contain this >> function!"' failed. >> >>It seems like I need to link a library to it but I'm not sure how to resolve this. Funny thing, when I use lli -force-interpreter, some of the program runs but have this error message Tried to execute an unknown external function: sbyte * (sbyte *) * gets Again, I'd like to know how I should link in the function so that it doesn't complain or fail. Thank you very much. Alex
On Wed, 14 Apr 2004, Alex Li wrote:> I'm a cs326 student that uses LLVM for our MP. While some of the COOL > program can be run seamlessly, I get the following assertion error for > many of them. > > lli: Pass.cpp:95: bool llvm::FunctionPassManager::run(llvm::Function&): > >> Assertion `(&F == mF) && "ModuleProvider does not contain this > >> function!"' failed. > > It seems like I need to link a library to it but I'm not sure how to > resolve this.I really have no idea what is going on here. From my understanding, you were given a "reduced" version of LLVM to use for CS326. It's quite possible that there is a problem with the reduction that is causing this. In any case, without more information (a stack trace from GDB for example), I can't really diagnose the issue.> Funny thing, when I use lli -force-interpreter, some of the program runs > but have this error message > Tried to execute an unknown external function: sbyte * (sbyte *) * getsThe interpreter is not something that can be relied on, except for trivial testcases. It does not have a generic "foreign function interface" so it cannot call external functions that it does not know about.> Again, I'd like to know how I should link in the function so that it > doesn't complain or fail.Try sending in a stack trace. In particular, run the program in the JIT, but under gdb: $ gdb --args lli foo.bc .... gdb> run ... gdb> bt and send me the output. Thanks! -Chris -- http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/
On most libc implementations, gets is a macro not a function which is why the FunctionPassManager can't find it. But, if you were compiling from C, it should never have been requested as a function. Is this in LLVM assembly that you tried to call gets? If so, that's the problem, it doesn't (and won't) exist anywhere. Linux has deprecated use of gets forever. From the man page: BUGS Never use gets(). Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store characters past the end of the buffer, it is extremely dangerous to use. It has been used to break computer security. Use fgets() instead. Reid. On Wed, 2004-04-14 at 20:11, Alex Li wrote:> Hi, > > I'm a cs326 student that uses LLVM for our MP. While some of the COOL > program can be run seamlessly, I get the following assertion error for > many of them. > > lli: Pass.cpp:95: bool llvm::FunctionPassManager::run(llvm::Function&): > >> Assertion `(&F == mF) && "ModuleProvider does not contain this > >> function!"' failed. > >> > >> > > It seems like I need to link a library to it but I'm not sure how to resolve this. > > Funny thing, when I use lli -force-interpreter, some of the program runs but have this error message > > Tried to execute an unknown external function: sbyte * (sbyte *) * gets > > Again, I'd like to know how I should link in the function so that it > doesn't complain or fail. > > Thank you very much. > > Alex > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev_______________________ Reid Spencer President & CTO eXtensible Systems, Inc. rspencer at x10sys.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040414/0f547659/attachment.sig>