[PATCH] Object: Move auxiliary symbol definitions from llvm-readobj
David Majnemer
david.majnemer at gmail.com
Mon Mar 17 22:35:03 PDT 2014
Hi rafael, nrieck, ruiu,
These definitions are useful to other aspects of LLVM, move them out.
http://llvm-reviews.chandlerc.com/D3105
Files:
include/llvm/Object/COFF.h
tools/llvm-readobj/COFFDumper.cpp
Index: include/llvm/Object/COFF.h
===================================================================
--- include/llvm/Object/COFF.h
+++ include/llvm/Object/COFF.h
@@ -228,20 +228,43 @@
support::ulittle16_t Type;
};
+struct coff_aux_function_definition {
+ support::ulittle32_t TagIndex;
+ support::ulittle32_t TotalSize;
+ support::ulittle32_t PointerToLinenumber;
+ support::ulittle32_t PointerToNextFunction;
+ char unused[2];
+};
+
+struct coff_aux_bf_and_ef_symbol {
+ char unused1[4];
+ support::ulittle16_t Linenumber;
+ char unused2[6];
+ support::ulittle32_t PointerToNextFunction;
+ char unused3[2];
+};
+
struct coff_aux_weak_external {
support::ulittle32_t TagIndex;
support::ulittle32_t Characteristics;
- char Unused[10];
+ char unused[10];
};
struct coff_aux_section_definition {
support::ulittle32_t Length;
support::ulittle16_t NumberOfRelocations;
support::ulittle16_t NumberOfLinenumbers;
support::ulittle32_t CheckSum;
support::ulittle16_t Number;
- support::ulittle8_t Selection;
- char Unused[3];
+ support::ulittle8_t Selection;
+ char unused[3];
+};
+
+struct coff_aux_clr_token {
+ support::ulittle8_t AuxType;
+ support::ulittle8_t Reserved;
+ support::ulittle32_t SymbolTableIndex;
+ char unused[12];
};
struct coff_load_configuration32 {
Index: tools/llvm-readobj/COFFDumper.cpp
===================================================================
--- tools/llvm-readobj/COFFDumper.cpp
+++ tools/llvm-readobj/COFFDumper.cpp
@@ -430,30 +430,9 @@
// Some additional COFF structures not defined by llvm::object.
namespace {
- struct coff_aux_function_definition {
- support::ulittle32_t TagIndex;
- support::ulittle32_t TotalSize;
- support::ulittle32_t PointerToLineNumber;
- support::ulittle32_t PointerToNextFunction;
- uint8_t Unused[2];
- };
-
- struct coff_aux_weak_external_definition {
- support::ulittle32_t TagIndex;
- support::ulittle32_t Characteristics;
- uint8_t Unused[10];
- };
-
struct coff_aux_file_record {
char FileName[18];
};
-
- struct coff_aux_clr_token {
- support::ulittle8_t AuxType;
- support::ulittle8_t Reserved;
- support::ulittle32_t SymbolTableIndex;
- uint8_t Unused[12];
- };
} // namespace
static uint64_t getOffsetOfLSDA(const Win64EH::UnwindInfo& UI) {
@@ -978,24 +957,26 @@
if (Symbol->StorageClass == COFF::IMAGE_SYM_CLASS_EXTERNAL &&
Symbol->getBaseType() == COFF::IMAGE_SYM_TYPE_NULL &&
Symbol->getComplexType() == COFF::IMAGE_SYM_DTYPE_FUNCTION &&
- Symbol->SectionNumber > 0) {
+ Symbol->SectionNumber != COFF::IMAGE_SYM_DEBUG &&
+ Symbol->SectionNumber != COFF::IMAGE_SYM_ABSOLUTE &&
+ Symbol->SectionNumber != COFF::IMAGE_SYM_UNDEFINED) {
const coff_aux_function_definition *Aux;
if (error(getSymbolAuxData(Obj, Symbol + I, Aux)))
break;
DictScope AS(W, "AuxFunctionDef");
W.printNumber("TagIndex", Aux->TagIndex);
W.printNumber("TotalSize", Aux->TotalSize);
- W.printHex("PointerToLineNumber", Aux->PointerToLineNumber);
+ W.printHex("PointerToLineNumber", Aux->PointerToLinenumber);
W.printHex("PointerToNextFunction", Aux->PointerToNextFunction);
- W.printBinary("Unused", makeArrayRef(Aux->Unused));
+ W.printBinary("Unused", makeArrayRef(Aux->unused));
} else if (
Symbol->StorageClass == COFF::IMAGE_SYM_CLASS_WEAK_EXTERNAL ||
(Symbol->StorageClass == COFF::IMAGE_SYM_CLASS_EXTERNAL &&
- Symbol->SectionNumber == 0 &&
+ Symbol->SectionNumber == COFF::IMAGE_SYM_UNDEFINED &&
Symbol->Value == 0)) {
- const coff_aux_weak_external_definition *Aux;
+ const coff_aux_weak_external *Aux;
if (error(getSymbolAuxData(Obj, Symbol + I, Aux)))
break;
@@ -1012,7 +993,7 @@
W.printNumber("Linked", LinkedName, Aux->TagIndex);
W.printEnum ("Search", Aux->Characteristics,
makeArrayRef(WeakExternalCharacteristics));
- W.printBinary("Unused", Aux->Unused);
+ W.printBinary("Unused", makeArrayRef(Aux->unused));
} else if (Symbol->StorageClass == COFF::IMAGE_SYM_CLASS_FILE) {
const coff_aux_file_record *Aux;
@@ -1038,7 +1019,7 @@
W.printHex("Checksum", Aux->CheckSum);
W.printNumber("Number", Aux->Number);
W.printEnum("Selection", Aux->Selection, makeArrayRef(ImageCOMDATSelect));
- W.printBinary("Unused", makeArrayRef(Aux->Unused));
+ W.printBinary("Unused", makeArrayRef(Aux->unused));
if (Section && Section->Characteristics & COFF::IMAGE_SCN_LNK_COMDAT
&& Aux->Selection == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE) {
@@ -1071,7 +1052,7 @@
W.printNumber("AuxType", Aux->AuxType);
W.printNumber("Reserved", Aux->Reserved);
W.printNumber("SymbolTableIndex", ReferredName, Aux->SymbolTableIndex);
- W.printBinary("Unused", Aux->Unused);
+ W.printBinary("Unused", makeArrayRef(Aux->unused));
} else {
W.startLine() << "<unhandled auxiliary record>\n";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3105.1.patch
Type: text/x-patch
Size: 5222 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140317/8cb8a1e6/attachment.bin>
More information about the llvm-commits
mailing list