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;
|
||||
}
|
||||
|
||||
public boolean isIndirect() {
|
||||
return n_sect == NListConstants.NO_SECT &&
|
||||
(n_type & NListConstants.MASK_N_TYPE) == NListConstants.TYPE_N_INDR;
|
||||
}
|
||||
|
||||
public boolean isSymbolicDebugging() {
|
||||
return (n_type & NListConstants.MASK_N_STAB) != 0;
|
||||
}
|
||||
|
|
|
@ -396,6 +396,11 @@ public class MachoProgramBuilder {
|
|||
continue;
|
||||
}
|
||||
|
||||
// is a re-exported symbol, will be added as an external later
|
||||
if (symbol.isIndirect()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (symbol.isExternal() || symbol.isPrivateExternal()) {
|
||||
program.getSymbolTable().addExternalEntryPoint(addr);
|
||||
}
|
||||
|
@ -483,8 +488,8 @@ public class MachoProgramBuilder {
|
|||
String name = generateValidName(symbol.getString());
|
||||
if (name != null && name.length() > 0) {
|
||||
try {
|
||||
program.getSymbolTable()
|
||||
.createLabel(startAddr, name, namespace, SourceType.IMPORTED);
|
||||
program.getSymbolTable().createLabel(startAddr, name, namespace,
|
||||
SourceType.IMPORTED);
|
||||
}
|
||||
catch (Exception e) {
|
||||
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);
|
||||
}
|
||||
else {
|
||||
program.getSymbolTable()
|
||||
.createLabel(address, ObjectiveC1_Constants.OBJC_MSG_SEND_RTP_NAME,
|
||||
SourceType.IMPORTED);
|
||||
program.getSymbolTable().createLabel(address,
|
||||
ObjectiveC1_Constants.OBJC_MSG_SEND_RTP_NAME, SourceType.IMPORTED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -593,8 +597,8 @@ public class MachoProgramBuilder {
|
|||
continue;
|
||||
}
|
||||
if (symbol.isTypeUndefined()) {
|
||||
List<Symbol> globalSymbols = program.getSymbolTable()
|
||||
.getLabelOrFunctionSymbols(symbol.getString(), null);
|
||||
List<Symbol> globalSymbols = program.getSymbolTable().getLabelOrFunctionSymbols(
|
||||
symbol.getString(), null);
|
||||
if (globalSymbols.isEmpty()) {//IF IT DOES NOT ALREADY EXIST...
|
||||
undefinedSymbols.add(symbol);
|
||||
}
|
||||
|
@ -946,8 +950,8 @@ public class MachoProgramBuilder {
|
|||
* See crt.c from opensource.apple.com
|
||||
*/
|
||||
private void processProgramVars() {
|
||||
if (program.getLanguage().getProcessor() == Processor
|
||||
.findOrPossiblyCreateProcessor("PowerPC")) {
|
||||
if (program.getLanguage().getProcessor() == Processor.findOrPossiblyCreateProcessor(
|
||||
"PowerPC")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1080,20 +1084,18 @@ public class MachoProgramBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
program.getRelocationTable()
|
||||
.add(address, relocationInfo.getType(),
|
||||
program.getRelocationTable().add(address, relocationInfo.getType(),
|
||||
new long[] { relocationInfo.getValue(), relocationInfo.getLength(),
|
||||
relocationInfo.isPcRelocated() ? 1 : 0,
|
||||
relocationInfo.isExternal() ? 1 : 0,
|
||||
relocationInfo.isScattered() ? 1 : 0},
|
||||
relocationInfo.isPcRelocated() ? 1 : 0, relocationInfo.isExternal() ? 1 : 0,
|
||||
relocationInfo.isScattered() ? 1 : 0 },
|
||||
origBytes, relocation.getTargetDescription());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleRelocationError(Address address, String message) {
|
||||
program.getBookmarkManager()
|
||||
.setBookmark(address, BookmarkType.ERROR, "Relocations", message);
|
||||
program.getBookmarkManager().setBookmark(address, BookmarkType.ERROR, "Relocations",
|
||||
message);
|
||||
log.appendMsg(message);
|
||||
}
|
||||
|
||||
|
@ -1180,9 +1182,8 @@ public class MachoProgramBuilder {
|
|||
|
||||
byte[] originalRelocationBytes = getOriginalRelocationBytes(relocation, relocationAddress);
|
||||
|
||||
program.getRelocationTable()
|
||||
.add(relocationAddress, relocation.getType(), relocation.toValues(),
|
||||
originalRelocationBytes, null);
|
||||
program.getRelocationTable().add(relocationAddress, relocation.getType(),
|
||||
relocation.toValues(), originalRelocationBytes, null);
|
||||
}
|
||||
|
||||
private void addLibrary(String library) {
|
||||
|
@ -1297,9 +1298,8 @@ public class MachoProgramBuilder {
|
|||
|
||||
private void markAsThumb(Address address)
|
||||
throws ContextChangeException, AddressOverflowException {
|
||||
if (!program.getLanguage()
|
||||
.getProcessor()
|
||||
.equals(Processor.findOrPossiblyCreateProcessor("ARM"))) {
|
||||
if (!program.getLanguage().getProcessor().equals(
|
||||
Processor.findOrPossiblyCreateProcessor("ARM"))) {
|
||||
return;
|
||||
}
|
||||
if ((address.getOffset() & 1) == 1) {
|
||||
|
@ -1327,9 +1327,8 @@ public class MachoProgramBuilder {
|
|||
try {
|
||||
MemoryBlock memoryBlock = memory.getBlock(reference.getToAddress());
|
||||
Namespace namespace = createNamespace(memoryBlock.getName());
|
||||
program.getSymbolTable()
|
||||
.createLabel(reference.getToAddress(), fromSymbol.getName(), namespace,
|
||||
SourceType.IMPORTED);
|
||||
program.getSymbolTable().createLabel(reference.getToAddress(),
|
||||
fromSymbol.getName(), namespace, SourceType.IMPORTED);
|
||||
}
|
||||
catch (Exception e) {
|
||||
//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) {
|
||||
try {
|
||||
return program.getSymbolTable()
|
||||
.createNameSpace(program.getGlobalNamespace(), namespaceName,
|
||||
SourceType.IMPORTED);
|
||||
return program.getSymbolTable().createNameSpace(program.getGlobalNamespace(),
|
||||
namespaceName, SourceType.IMPORTED);
|
||||
}
|
||||
catch (DuplicateNameException | InvalidInputException e) {
|
||||
Namespace namespace =
|
||||
|
|
|
@ -128,14 +128,6 @@ eclipse {
|
|||
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 {
|
||||
appliesTo = 'FILES_AND_FOLDERS'
|
||||
type = 'EXCLUDE_ALL'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue