[LLVMdev] MC and admisible function names
Óscar Fuentes
ofv at wanadoo.es
Sat Dec 1 02:33:23 PST 2012
Hello Andy,
"Kaylor, Andrew" <andrew.kaylor at intel.com> writes:
> I'm not aware of any intentional function name limitations with MCJIT.
> It's entirely possible that something somewhere is rejecting the name
> for one reason or another (intentionally or otherwise).
Yep, apparently those names with characters outside the acceptable range
of the object file format in use (ELF, in my case) are mangled, so this
name:
Fn_.._lib_rc-variant.lp0_17_0x706970
becomes this:
Fn_.._lib_rc_2D_variant.lp0_17_0x706970
> When you call getPointerToFunction in MCJIT, it will ultimately call
> RuntimeDyldImpl::getSymbolLoadAddress to look the name up in a table
> of known function names. That table gets built from the emitted object
> image during the RuntimeDyldImpl::loadObject call. If you set a
> breakpoint in that function you can see all the symbol names that get
> processed and it will probably tell you why the function isn't being
> found.
RuntimeDyldImpl::loadObject loads the mangled names, but
RuntimeDyldImpl::getSymbolLoadAddress does not try to "normalize" the
symbol name to conform to the rules of the object format, so it looks
for the user-provided name, which fails.
I guess that the solution is to transparently "normalize" the symbol
name being searched before the lookup into the object's symbol table
(but not when using JITMemoryManager::getPointerToNamedFunction, which
works on the user's private namespace and is independent of the object.)
More information about the llvm-dev
mailing list