[llvm-commits] [llvm] r131603 - /llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp

Chris Lattner clattner at apple.com
Wed May 18 17:14:02 PDT 2011


On May 18, 2011, at 4:56 PM, Jim Grosbach wrote:

> Author: grosbach
> Date: Wed May 18 18:56:43 2011
> New Revision: 131603
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=131603&view=rev
> Log:
> Restore sanity to 131601.
> 
> Modified:
>    llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
> 
> Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=131603&r1=131602&r2=131603&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Wed May 18 18:56:43 2011
> @@ -104,10 +104,11 @@
> 
>   // FIXME: Should we be using the mangler for this? Probably.
>   StringRef BaseName = F->getName();
> +  Twine Name;
>   if (BaseName[0] == '\1')
> -    BaseName = BaseName.substr(1);
> +    Name = BaseName.substr(1);
>   else
> -    Twine Name = TM->getMCAsmInfo()->getGlobalPrefix() + BaseName;
> +    Name = TM->getMCAsmInfo()->getGlobalPrefix() + BaseName;
>   return (void*)Dyld.getSymbolAddress(Name.str());
> }

Hi Jim,

This code won't work.  The temporary formed by the "+" in the second case dies too early.  You need to do something like this:

return (void*)Dyld.getSymbolAddress(TM->getMCAsmInfo()->getGlobalPrefix() + BaseName);

-Chris



More information about the llvm-commits mailing list