mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
Objective C functions may use a magic '\1' on the name. Handle that when
dealing with them in the MCJIT. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131601 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
49fcf571da
commit
3ec2c7c3e4
@ -102,7 +102,12 @@ void *MCJIT::getPointerToFunction(Function *F) {
|
||||
return Addr;
|
||||
}
|
||||
|
||||
Twine Name = TM->getMCAsmInfo()->getGlobalPrefix() + F->getName();
|
||||
// FIXME: Should we be using the mangler for this? Probably.
|
||||
StringRef BaseName = F->getName();
|
||||
if (BaseName[0] == '\1')
|
||||
BaseName = BaseName.substr(1);
|
||||
else
|
||||
Twine Name = TM->getMCAsmInfo()->getGlobalPrefix() + BaseName;
|
||||
return (void*)Dyld.getSymbolAddress(Name.str());
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,11 @@ public:
|
||||
// prefix.
|
||||
if (Name[0] == '_') ++Name;
|
||||
Function *F = M->getFunction(Name);
|
||||
// Some ObjC names have a prefixed \01 in the IR. If we failed to find
|
||||
// the symbol and it's of the ObjC conventions (starts with "-"), try
|
||||
// prepending a \01 and see if we can find it that way.
|
||||
if (!F && Name[0] == '-')
|
||||
F = M->getFunction((Twine("\1") + Name).str());
|
||||
assert(F && "No matching function in JIT IR Module!");
|
||||
return JMM->startFunctionBody(F, Size);
|
||||
}
|
||||
@ -48,6 +53,11 @@ public:
|
||||
// prefix.
|
||||
if (Name[0] == '_') ++Name;
|
||||
Function *F = M->getFunction(Name);
|
||||
// Some ObjC names have a prefixed \01 in the IR. If we failed to find
|
||||
// the symbol and it's of the ObjC conventions (starts with "-"), try
|
||||
// prepending a \01 and see if we can find it that way.
|
||||
if (!F && Name[0] == '-')
|
||||
F = M->getFunction((Twine("\1") + Name).str());
|
||||
assert(F && "No matching function in JIT IR Module!");
|
||||
JMM->endFunctionBody(F, FunctionStart, FunctionEnd);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user