diff --git a/Include/Library/OcMachoLib.h b/Include/Library/OcMachoLib.h index f82e1c2f..426c7122 100644 --- a/Include/Library/OcMachoLib.h +++ b/Include/Library/OcMachoLib.h @@ -292,21 +292,6 @@ MachoRelocateSymbol64 ( IN OUT MACH_NLIST_64 *Symbol ); -/** - Retrieves a C++ symbol by the Relocation it is referenced by. - - @param[in,out] Context Context of the Mach-O. - @param[in] Relocation The Relocation to evaluate. - - @retval NULL NULL is returned on failure. - -**/ -CONST MACH_NLIST_64 * -MachoGetCxxSymbolByExternRelocation64 ( - IN OUT VOID *Context, - IN CONST MACH_RELOCATION_INFO *Relocation - ); - /** Returns whether Name is pure virtual. diff --git a/Library/OcMachoLib/CxxSymbols.c b/Library/OcMachoLib/CxxSymbols.c index 506c2c7c..9fc1f1c3 100644 --- a/Library/OcMachoLib/CxxSymbols.c +++ b/Library/OcMachoLib/CxxSymbols.c @@ -561,17 +561,22 @@ MachoGetMetaclassSymbolFromSmcpSymbol64 ( IN CONST MACH_NLIST_64 *Smcp ) { - CONST MACH_RELOCATION_INFO *Relocation; + BOOLEAN Result; + MACH_NLIST_64 *Symbol; ASSERT (Context != NULL); ASSERT (Smcp != NULL); - Relocation = MachoGetExternalRelocationByOffset (Context, Smcp->Value); - if (Relocation == NULL) { + Result = MachoGetSymbolByExternRelocationOffset64 ( + Context, + Smcp->Value, + &Symbol + ); + if (!Result) { return NULL; } - return MachoGetCxxSymbolByExternRelocation64 (Context, Relocation); + return Symbol; } /** diff --git a/Library/OcMachoLib/Symbols.c b/Library/OcMachoLib/Symbols.c index d5a552a8..15a9734e 100644 --- a/Library/OcMachoLib/Symbols.c +++ b/Library/OcMachoLib/Symbols.c @@ -383,51 +383,3 @@ MachoRelocateSymbol64 ( return TRUE; } - -/** - Retrieves a C++ symbol by the extern Relocation it is referenced by. - - @param[in,out] Context Context of the Mach-O. - @param[in] Relocation The extern Relocation to evaluate. - - @retval NULL NULL is returned on failure. - -**/ -CONST MACH_NLIST_64 * -MachoGetCxxSymbolByExternRelocation64 ( - IN OUT VOID *Context, - IN CONST MACH_RELOCATION_INFO *Relocation - ) -{ - OC_MACHO_CONTEXT *MachoContext; - CONST MACH_NLIST_64 *SymbolTable; - CONST CHAR8 *StringTable; - CONST MACH_NLIST_64 *Symbol; - - ASSERT (Context != NULL); - ASSERT (Relocation != NULL); - ASSERT (Relocation->Extern != 0); - - MachoContext = (OC_MACHO_CONTEXT *)Context; - - if ((MachoContext->SymbolTable == NULL) - && !InternalRetrieveSymtabs64 (MachoContext)) { - return NULL; - } - - SymbolTable = MachoContext->SymbolTable; - StringTable = MachoContext->StringTable; - ASSERT (SymbolTable != NULL); - ASSERT (StringTable != NULL); - // - // Scattered Relocations are only supported by i386. - // - ASSERT (((UINT32)Relocation->Address & MACH_RELOC_SCATTERED) == 0); - - Symbol = &SymbolTable[Relocation->SymbolNumber]; - if (InternalSymbolIsSane (MachoContext, Symbol)) { - return Symbol; - } - - return NULL; -}