[LLVMdev] MC and admisible function names
ofv at wanadoo.es
Sat Dec 1 02:33:23 PST 2012
"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
> 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
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