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