mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
OcMachoLib: Correctly detect symbol definition and section type.
This commit is contained in:
parent
37e30743fd
commit
2ac0ee8085
@ -86,20 +86,21 @@ MachoIsSymbolValueInRange64 (
|
||||
}
|
||||
|
||||
/**
|
||||
Returns whether Symbol describes a section.
|
||||
Returns whether Symbol describes a section type.
|
||||
|
||||
@param[in] Symbol Symbol to evaluate.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
BOOLEAN
|
||||
MachoSymbolIsSection (
|
||||
InternalSymbolIsSectionType (
|
||||
IN CONST MACH_NLIST_64 *Symbol
|
||||
)
|
||||
{
|
||||
ASSERT (Symbol != NULL);
|
||||
|
||||
if ((Symbol->Type & MACH_N_TYPE_STAB) != 0) {
|
||||
switch (Symbol->Type & MACH_N_TYPE_STAB) {
|
||||
switch (Symbol->Type) {
|
||||
//
|
||||
// Labeled as MACH_N_sect in stab.h
|
||||
//
|
||||
@ -137,6 +138,21 @@ MachoSymbolIsSection (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns whether Symbol describes a section.
|
||||
|
||||
@param[in] Symbol Symbol to evaluate.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
MachoSymbolIsSection (
|
||||
IN CONST MACH_NLIST_64 *Symbol
|
||||
)
|
||||
{
|
||||
ASSERT (Symbol != NULL);
|
||||
return (InternalSymbolIsSectionType (Symbol) && (Symbol->Section != NO_SECT));
|
||||
}
|
||||
|
||||
/**
|
||||
Returns whether Symbol is defined.
|
||||
|
||||
@ -152,7 +168,7 @@ MachoSymbolIsDefined (
|
||||
|
||||
return (((Symbol->Type & MACH_N_TYPE_STAB) == 0)
|
||||
&& (((Symbol->Type & MACH_N_TYPE_TYPE) == MACH_N_TYPE_ABS)
|
||||
|| MachoSymbolIsSection (Symbol)));
|
||||
|| InternalSymbolIsSectionType (Symbol)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user