summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm64/arch_arm64.cpp18
-rw-r--r--arch/mips/arch_mips.cpp30
2 files changed, 42 insertions, 6 deletions
diff --git a/arch/arm64/arch_arm64.cpp b/arch/arm64/arch_arm64.cpp
index ffa05fe8..68cfae5a 100644
--- a/arch/arm64/arch_arm64.cpp
+++ b/arch/arm64/arch_arm64.cpp
@@ -2448,10 +2448,22 @@ class Arm64ImportedFunctionRecognizer : public FunctionRecognizer
if (jumpOperand.GetSourceRegister<LLIL_REG>() != targetReg)
return false;
- Ref<Symbol> funcSym = Symbol::ImportedFunctionFromImportAddressSymbol(sym, func->GetStart());
+ Ref<Symbol> funcSym = Symbol::ImportedFunctionFromImportAddressSymbol(sym, func->GetStart()); // func is plt function
data->DefineAutoSymbol(funcSym);
- func->ApplyImportedTypes(funcSym);
- return true;
+ for (auto& extSym : data->GetSymbolsByName(funcSym->GetRawName()))
+ {
+ if (extSym->GetType() == ExternalSymbol)
+ {
+ DataVariable var;
+ if (data->GetDataVariableAtAddress(extSym->GetAddress(), var))
+ {
+ func->ApplyImportedTypes(funcSym, var.type);
+ }
+
+ return true;
+ }
+ }
+ return false;
}
diff --git a/arch/mips/arch_mips.cpp b/arch/mips/arch_mips.cpp
index 50ad0f75..1fa6b169 100644
--- a/arch/mips/arch_mips.cpp
+++ b/arch/mips/arch_mips.cpp
@@ -1747,8 +1747,20 @@ private:
Ref<Symbol> funcSym = Symbol::ImportedFunctionFromImportAddressSymbol(sym, func->GetStart());
data->DefineAutoSymbol(funcSym);
- func->ApplyImportedTypes(funcSym);
- return true;
+ for (auto& extSym : data->GetSymbolsByName(funcSym->GetRawName()))
+ {
+ if (extSym->GetType() == ExternalSymbol)
+ {
+ DataVariable var;
+ if (data->GetDataVariableAtAddress(extSym->GetAddress(), var))
+ {
+ func->ApplyImportedTypes(funcSym, var.type);
+ }
+
+ return true;
+ }
+ }
+ return false;
}
@@ -1939,7 +1951,19 @@ private:
Ref<Symbol> funcSym = Symbol::ImportedFunctionFromImportAddressSymbol(sym, func->GetStart());
data->DefineAutoSymbol(funcSym);
- func->ApplyImportedTypes(funcSym);
+ for (auto& extSym : data->GetSymbolsByName(funcSym->GetRawName()))
+ {
+ if (extSym->GetType() == ExternalSymbol)
+ {
+ DataVariable var;
+ if (data->GetDataVariableAtAddress(extSym->GetAddress(), var))
+ {
+ func->ApplyImportedTypes(funcSym, var.type);
+ }
+
+ return true;
+ }
+ }
return true;
}