mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-02-16 15:40:14 +00:00
Merge remote-tracking branch 'origin/GP-4344_ryanmkurtz_coff' into patch
(Closes #6236)
This commit is contained in:
commit
9951e54209
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -16,13 +15,13 @@
|
||||
*/
|
||||
package ghidra.app.util.bin.format.coff;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverterUtil;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CoffSymbolAuxBeginningOfBlock implements CoffSymbolAux {
|
||||
|
||||
private byte [] unused1;
|
||||
@ -34,7 +33,7 @@ public class CoffSymbolAuxBeginningOfBlock implements CoffSymbolAux {
|
||||
CoffSymbolAuxBeginningOfBlock(BinaryReader reader) throws IOException {
|
||||
unused1 = reader.readNextByteArray(4);
|
||||
sourceLineNumber = reader.readNextShort();
|
||||
unused2 = reader.readNextByteArray(5);
|
||||
unused2 = reader.readNextByteArray(6);
|
||||
nextEntryIndex = reader.readNextInt();
|
||||
unused3 = reader.readNextByteArray(2);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -22,7 +21,7 @@ public final class CoffSymbolSectionNumber {
|
||||
/** absolute symbols */
|
||||
public final static short N_ABS = -1;
|
||||
/** undefined external symbol */
|
||||
public final static short N_UNDEf = 0;
|
||||
public final static short N_UNDEF = 0;
|
||||
/** .text section symbol */
|
||||
public final static short N_TEXT = 1;
|
||||
/** .data section symbol */
|
||||
|
@ -242,7 +242,7 @@ public class CoffLoader extends AbstractLibrarySupportLoader {
|
||||
Address address = null;
|
||||
try {
|
||||
short sectionNum = symbol.getSectionNumber();
|
||||
if (sectionNum == 0) {//external symbols
|
||||
if (sectionNum == CoffSymbolSectionNumber.N_UNDEF) {//external symbols
|
||||
address = externalAddress;
|
||||
String name = symbol.getName();
|
||||
Symbol sym = symbolTable.getGlobalSymbol(name, address);
|
||||
@ -255,13 +255,17 @@ public class CoffLoader extends AbstractLibrarySupportLoader {
|
||||
externalAddress = externalAddress
|
||||
.add(getPointerSizeAligned(externalAddress.getAddressSpace()));
|
||||
}
|
||||
else if (sectionNum <= -2) {
|
||||
else if (sectionNum < CoffSymbolSectionNumber.N_DEBUG) {
|
||||
log.appendMsg("Strange symbol " + symbol + " : " + symbol.getBasicType() +
|
||||
" - from section " + sectionNum);
|
||||
}
|
||||
else if (sectionNum == CoffSymbolSectionNumber.N_DEBUG) {
|
||||
// skip debug symbols
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
CoffSectionHeader section = null;
|
||||
if (sectionNum == -1) { // absolute symbols
|
||||
if (sectionNum == CoffSymbolSectionNumber.N_ABS) { // absolute symbols {
|
||||
// usually corresponds to IO or memory registers
|
||||
address = CoffSectionHeader.getAddress(program.getLanguage(),
|
||||
symbol.getValue(), program.getLanguage().getDefaultDataSpace());
|
||||
|
Loading…
Reference in New Issue
Block a user