Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-5216 Correct BSim signature apply bug

ghidra1dacc9b226d8a
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/program/util/FunctionUtility.java b/Ghidra/Features/Base/src/main/java/ghidra/program/util/FunctionUtility.java
index 01e101a9fa..7a60365e42 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/program/util/FunctionUtility.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/program/util/FunctionUtility.java
@@ -381,16 +381,17 @@ public class FunctionUtility {
return sourceConv;
}
boolean applyConventionName = sameLanguageAndCompilerSpec;
- if (applyConventionName) {
+ String callingConvention = sourceFunction.getCallingConventionName();
+ if (applyConventionName &&
+ !CompilerSpec.CALLING_CONVENTION_default.equals(callingConvention)) {
DataTypeManager dtMgr = destinationFunction.getProgram().getDataTypeManager();
- String name = destinationFunction.getCallingConventionName();
- if (GenericCallingConvention
- .getGenericCallingConvention(name) == GenericCallingConvention.unknown &&
- !dtMgr.getKnownCallingConventionNames().contains(name)) {
+ if (GenericCallingConvention.getGenericCallingConvention(
+ callingConvention) == GenericCallingConvention.unknown &&
+ !dtMgr.getKnownCallingConventionNames().contains(callingConvention)) {
applyConventionName = false;
}
}
- return applyConventionName ? sourceFunction.getCallingConventionName()
+ return applyConventionName ? callingConvention
: destinationFunction.getCallingConventionName();
}