mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-21 10:11:42 +08:00
GP-4662: Fixing Swift opinion regression
This commit is contained in:
@@ -29,6 +29,8 @@ import ghidra.program.model.mem.MemoryBlock;
|
||||
*/
|
||||
public class SwiftUtils {
|
||||
|
||||
public static final String SWIFT_COMPILER = "swift";
|
||||
|
||||
/**
|
||||
* A {@link PointerTypedef pointer} to a relative 4-byte offset
|
||||
*/
|
||||
|
||||
@@ -84,11 +84,13 @@ public class MachoLoader extends AbstractLibrarySupportLoader {
|
||||
.flatMap(seg -> seg.getSections().stream())
|
||||
.map(section -> section.getSectionName())
|
||||
.toList();
|
||||
String compiler = SwiftUtils.isSwift(sectionNames) ? "swift" : null;
|
||||
compiler = compiler == null && GoRttiMapper.hasGolangSections(sectionNames)
|
||||
? GoConstants.GOLANG_CSPEC_NAME
|
||||
: null;
|
||||
return compiler;
|
||||
if (SwiftUtils.isSwift(sectionNames)) {
|
||||
return SwiftUtils.SWIFT_COMPILER;
|
||||
}
|
||||
if (GoRttiMapper.hasGolangSections(sectionNames)) {
|
||||
return GoConstants.GOLANG_CSPEC_NAME;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,8 +28,8 @@ import ghidra.app.util.Option;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.ByteProvider;
|
||||
import ghidra.app.util.bin.format.elf.info.ElfInfoItem.ItemWithAddress;
|
||||
import ghidra.app.util.bin.format.golang.GoBuildInfo;
|
||||
import ghidra.app.util.bin.format.golang.GoBuildId;
|
||||
import ghidra.app.util.bin.format.golang.GoBuildInfo;
|
||||
import ghidra.app.util.bin.format.golang.rtti.GoRttiMapper;
|
||||
import ghidra.app.util.bin.format.mz.DOSHeader;
|
||||
import ghidra.app.util.bin.format.pe.*;
|
||||
@@ -922,7 +922,7 @@ public class PeLoader extends AbstractPeDebugLoader {
|
||||
CLI("cli", "cli"),
|
||||
Rustc(RustConstants.RUST_COMPILER, RustConstants.RUST_COMPILER),
|
||||
GOLANG("golang", "golang"),
|
||||
Swift("swift", "swift"),
|
||||
Swift(SwiftUtils.SWIFT_COMPILER, SwiftUtils.SWIFT_COMPILER),
|
||||
Unknown("unknown", "unknown"),
|
||||
|
||||
// The following values represent the presence of ambiguous indicators
|
||||
|
||||
Reference in New Issue
Block a user