[LLVMdev] HowToUseJIT: failed assertion on PPC/Mac OS X

Chris Lattner sabre at nondot.org
Sun Feb 20 10:54:11 PST 2005


On Sun, 20 Feb 2005, Evan Jones wrote:
> On Feb 20, 2005, at 11:12, Evan Jones wrote:
>> I can "fix" it by changing JITResolver::getFunctionStub to use 
>> F->isExternal() instead of F->hasExternalLinkage(). However, this then 
>> breaks when calling *real* external functions (native code).
>
> I obviously should not post to mailing lists before I've eaten. With my "fix" 
> I get an assertion when taking an address of a function, not with native 
> code:
> The backtrace is the same as before: a recursive JIT loop. In this case, 
> F->isExternal() returns "true" because the function has not yet been loaded 
> (?). A hack to fix both issues is to change the conditional to test both 
> F->hasExternalLinkage() && F->isExternal().

Yup, this is basically right.  I've committed this patch to fix it:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050214/024196.html

> At any rate, I've attached a new patch which "works for me" on PPC and x86. 
> At this point, I really don't know what is going on, so I really don't know 
> if it is correct.

You're right, and this is a general problem.  After puzzling over it for a 
while, I realized that the llvm-test programs are all run after the 
-internalize pass has been run on them.  This means that the only 
functions with external linkage are those that ARE external.  The
HowToUseTheJIT example builds functions that have external linkage but 
aren't external.

Thanks for noticing this bug!!  Please let us know if you run into 
anything else,

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-dev mailing list