mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
cf293853e8
8 changed files with 35 additions and 117 deletions
|
@ -1,2 +0,0 @@
|
||||||
MODULE FILE LICENSE: os/linux64/cabextract GPL 3
|
|
||||||
MODULE FILE LICENSE: os/osx64/cabextract GPL 3
|
|
|
@ -1,67 +0,0 @@
|
||||||
/* ###
|
|
||||||
* IP: Public Domain
|
|
||||||
*/
|
|
||||||
apply from: file("../gpl.gradle").getCanonicalPath()
|
|
||||||
|
|
||||||
if (findProject(':Generic') != null) {
|
|
||||||
apply from: "$rootProject.projectDir/gradle/nativeProject.gradle"
|
|
||||||
apply from: "$rootProject.projectDir/gradle/distributableGPLModule.gradle"
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
apply from: "../nativeBuildProperties.gradle"
|
|
||||||
}
|
|
||||||
|
|
||||||
apply plugin: 'eclipse'
|
|
||||||
|
|
||||||
eclipse.project.name = 'GPL CabExtract'
|
|
||||||
|
|
||||||
project.ext.cabextract = "cabextract-1.6"
|
|
||||||
|
|
||||||
/*********************************************************************************
|
|
||||||
* Deprecated - will be removed
|
|
||||||
*********************************************************************************/
|
|
||||||
|
|
||||||
/*********************************************************************************
|
|
||||||
* CabExtract platform specific tasks
|
|
||||||
*
|
|
||||||
* The cabextract tool requires that its 'configure' script is called before make.
|
|
||||||
*********************************************************************************/
|
|
||||||
def currentPlatform = getCurrentPlatformName()
|
|
||||||
if (['linux64', 'osx64'].contains(currentPlatform)) {
|
|
||||||
|
|
||||||
def makeName = "${currentPlatform}CabExtractMake"
|
|
||||||
|
|
||||||
task (makeName, type: Exec) {
|
|
||||||
group "private"
|
|
||||||
workingDir "build/unpack/${cabextract}"
|
|
||||||
executable "make"
|
|
||||||
|
|
||||||
// Specify output so cabextract is only built if this is missing
|
|
||||||
outputs.file("build/os/${currentPlatform}/cabextract")
|
|
||||||
|
|
||||||
// Extract archive and ./configure
|
|
||||||
doFirst {
|
|
||||||
copy {
|
|
||||||
from tarTree(file("data/${cabextract}.tar.gz"))
|
|
||||||
into 'build/unpack'
|
|
||||||
}
|
|
||||||
// Force all unpacked files to have the same timestamp
|
|
||||||
ant.touch() {
|
|
||||||
fileset(dir: file("build/unpack/${cabextract}"))
|
|
||||||
}
|
|
||||||
exec {
|
|
||||||
workingDir "build/unpack/${cabextract}"
|
|
||||||
executable "./configure"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move out the built cabextract and delete the extracted files
|
|
||||||
doLast {
|
|
||||||
copy {
|
|
||||||
from "build/unpack/${cabextract}/cabextract"
|
|
||||||
into "build/os/${currentPlatform}"
|
|
||||||
}
|
|
||||||
delete file("build/unpack/${cabextract}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
##VERSION: 2.0
|
|
||||||
##MODULE IP: GPL 3
|
|
||||||
##MODULE IP: Public Domain
|
|
||||||
Module.manifest||Public Domain||||END|
|
|
||||||
data/cabextract-1.6.tar.gz||GPL 3||||END|
|
|
Binary file not shown.
|
@ -1,3 +0,0 @@
|
||||||
/* ###
|
|
||||||
* IP: Public Domain
|
|
||||||
*/
|
|
|
@ -150,6 +150,11 @@ public class NList implements StructConverter {
|
||||||
(n_type & NListConstants.MASK_N_TYPE) == NListConstants.TYPE_N_PBUD;
|
(n_type & NListConstants.MASK_N_TYPE) == NListConstants.TYPE_N_PBUD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isIndirect() {
|
||||||
|
return n_sect == NListConstants.NO_SECT &&
|
||||||
|
(n_type & NListConstants.MASK_N_TYPE) == NListConstants.TYPE_N_INDR;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSymbolicDebugging() {
|
public boolean isSymbolicDebugging() {
|
||||||
return (n_type & NListConstants.MASK_N_STAB) != 0;
|
return (n_type & NListConstants.MASK_N_STAB) != 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,6 +396,11 @@ public class MachoProgramBuilder {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// is a re-exported symbol, will be added as an external later
|
||||||
|
if (symbol.isIndirect()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (symbol.isExternal() || symbol.isPrivateExternal()) {
|
if (symbol.isExternal() || symbol.isPrivateExternal()) {
|
||||||
program.getSymbolTable().addExternalEntryPoint(addr);
|
program.getSymbolTable().addExternalEntryPoint(addr);
|
||||||
}
|
}
|
||||||
|
@ -483,8 +488,8 @@ public class MachoProgramBuilder {
|
||||||
String name = generateValidName(symbol.getString());
|
String name = generateValidName(symbol.getString());
|
||||||
if (name != null && name.length() > 0) {
|
if (name != null && name.length() > 0) {
|
||||||
try {
|
try {
|
||||||
program.getSymbolTable()
|
program.getSymbolTable().createLabel(startAddr, name, namespace,
|
||||||
.createLabel(startAddr, name, namespace, SourceType.IMPORTED);
|
SourceType.IMPORTED);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log.appendMsg("Unable to create indirect symbol " + name);
|
log.appendMsg("Unable to create indirect symbol " + name);
|
||||||
|
@ -565,9 +570,8 @@ public class MachoProgramBuilder {
|
||||||
symbol.setName(ObjectiveC1_Constants.OBJC_MSG_SEND_RTP_NAME, SourceType.IMPORTED);
|
symbol.setName(ObjectiveC1_Constants.OBJC_MSG_SEND_RTP_NAME, SourceType.IMPORTED);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
program.getSymbolTable()
|
program.getSymbolTable().createLabel(address,
|
||||||
.createLabel(address, ObjectiveC1_Constants.OBJC_MSG_SEND_RTP_NAME,
|
ObjectiveC1_Constants.OBJC_MSG_SEND_RTP_NAME, SourceType.IMPORTED);
|
||||||
SourceType.IMPORTED);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,8 +597,8 @@ public class MachoProgramBuilder {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (symbol.isTypeUndefined()) {
|
if (symbol.isTypeUndefined()) {
|
||||||
List<Symbol> globalSymbols = program.getSymbolTable()
|
List<Symbol> globalSymbols = program.getSymbolTable().getLabelOrFunctionSymbols(
|
||||||
.getLabelOrFunctionSymbols(symbol.getString(), null);
|
symbol.getString(), null);
|
||||||
if (globalSymbols.isEmpty()) {//IF IT DOES NOT ALREADY EXIST...
|
if (globalSymbols.isEmpty()) {//IF IT DOES NOT ALREADY EXIST...
|
||||||
undefinedSymbols.add(symbol);
|
undefinedSymbols.add(symbol);
|
||||||
}
|
}
|
||||||
|
@ -946,8 +950,8 @@ public class MachoProgramBuilder {
|
||||||
* See crt.c from opensource.apple.com
|
* See crt.c from opensource.apple.com
|
||||||
*/
|
*/
|
||||||
private void processProgramVars() {
|
private void processProgramVars() {
|
||||||
if (program.getLanguage().getProcessor() == Processor
|
if (program.getLanguage().getProcessor() == Processor.findOrPossiblyCreateProcessor(
|
||||||
.findOrPossiblyCreateProcessor("PowerPC")) {
|
"PowerPC")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1080,11 +1084,9 @@ public class MachoProgramBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
program.getRelocationTable()
|
program.getRelocationTable().add(address, relocationInfo.getType(),
|
||||||
.add(address, relocationInfo.getType(),
|
|
||||||
new long[] { relocationInfo.getValue(), relocationInfo.getLength(),
|
new long[] { relocationInfo.getValue(), relocationInfo.getLength(),
|
||||||
relocationInfo.isPcRelocated() ? 1 : 0,
|
relocationInfo.isPcRelocated() ? 1 : 0, relocationInfo.isExternal() ? 1 : 0,
|
||||||
relocationInfo.isExternal() ? 1 : 0,
|
|
||||||
relocationInfo.isScattered() ? 1 : 0 },
|
relocationInfo.isScattered() ? 1 : 0 },
|
||||||
origBytes, relocation.getTargetDescription());
|
origBytes, relocation.getTargetDescription());
|
||||||
}
|
}
|
||||||
|
@ -1092,8 +1094,8 @@ public class MachoProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRelocationError(Address address, String message) {
|
private void handleRelocationError(Address address, String message) {
|
||||||
program.getBookmarkManager()
|
program.getBookmarkManager().setBookmark(address, BookmarkType.ERROR, "Relocations",
|
||||||
.setBookmark(address, BookmarkType.ERROR, "Relocations", message);
|
message);
|
||||||
log.appendMsg(message);
|
log.appendMsg(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1180,9 +1182,8 @@ public class MachoProgramBuilder {
|
||||||
|
|
||||||
byte[] originalRelocationBytes = getOriginalRelocationBytes(relocation, relocationAddress);
|
byte[] originalRelocationBytes = getOriginalRelocationBytes(relocation, relocationAddress);
|
||||||
|
|
||||||
program.getRelocationTable()
|
program.getRelocationTable().add(relocationAddress, relocation.getType(),
|
||||||
.add(relocationAddress, relocation.getType(), relocation.toValues(),
|
relocation.toValues(), originalRelocationBytes, null);
|
||||||
originalRelocationBytes, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addLibrary(String library) {
|
private void addLibrary(String library) {
|
||||||
|
@ -1297,9 +1298,8 @@ public class MachoProgramBuilder {
|
||||||
|
|
||||||
private void markAsThumb(Address address)
|
private void markAsThumb(Address address)
|
||||||
throws ContextChangeException, AddressOverflowException {
|
throws ContextChangeException, AddressOverflowException {
|
||||||
if (!program.getLanguage()
|
if (!program.getLanguage().getProcessor().equals(
|
||||||
.getProcessor()
|
Processor.findOrPossiblyCreateProcessor("ARM"))) {
|
||||||
.equals(Processor.findOrPossiblyCreateProcessor("ARM"))) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((address.getOffset() & 1) == 1) {
|
if ((address.getOffset() & 1) == 1) {
|
||||||
|
@ -1327,9 +1327,8 @@ public class MachoProgramBuilder {
|
||||||
try {
|
try {
|
||||||
MemoryBlock memoryBlock = memory.getBlock(reference.getToAddress());
|
MemoryBlock memoryBlock = memory.getBlock(reference.getToAddress());
|
||||||
Namespace namespace = createNamespace(memoryBlock.getName());
|
Namespace namespace = createNamespace(memoryBlock.getName());
|
||||||
program.getSymbolTable()
|
program.getSymbolTable().createLabel(reference.getToAddress(),
|
||||||
.createLabel(reference.getToAddress(), fromSymbol.getName(), namespace,
|
fromSymbol.getName(), namespace, SourceType.IMPORTED);
|
||||||
SourceType.IMPORTED);
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
//log.appendMsg("Unable to create lazy pointer symbol " + fromSymbol.getName() + " at " + reference.getToAddress());
|
//log.appendMsg("Unable to create lazy pointer symbol " + fromSymbol.getName() + " at " + reference.getToAddress());
|
||||||
|
@ -1345,9 +1344,8 @@ public class MachoProgramBuilder {
|
||||||
|
|
||||||
private Namespace createNamespace(String namespaceName) {
|
private Namespace createNamespace(String namespaceName) {
|
||||||
try {
|
try {
|
||||||
return program.getSymbolTable()
|
return program.getSymbolTable().createNameSpace(program.getGlobalNamespace(),
|
||||||
.createNameSpace(program.getGlobalNamespace(), namespaceName,
|
namespaceName, SourceType.IMPORTED);
|
||||||
SourceType.IMPORTED);
|
|
||||||
}
|
}
|
||||||
catch (DuplicateNameException | InvalidInputException e) {
|
catch (DuplicateNameException | InvalidInputException e) {
|
||||||
Namespace namespace =
|
Namespace namespace =
|
||||||
|
|
|
@ -128,14 +128,6 @@ eclipse {
|
||||||
arguments = '1.0-name-matches-false-false-GhidraDocs'
|
arguments = '1.0-name-matches-false-false-GhidraDocs'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resourceFilter {
|
|
||||||
appliesTo = 'FILES_AND_FOLDERS'
|
|
||||||
type = 'EXCLUDE_ALL'
|
|
||||||
matcher {
|
|
||||||
id = 'org.eclipse.ui.ide.multiFilter'
|
|
||||||
arguments = '1.0-name-matches-false-true-CabExtract'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resourceFilter {
|
resourceFilter {
|
||||||
appliesTo = 'FILES_AND_FOLDERS'
|
appliesTo = 'FILES_AND_FOLDERS'
|
||||||
type = 'EXCLUDE_ALL'
|
type = 'EXCLUDE_ALL'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue