[llvm] r270636 - [codeview] Add support for S_EXPORT symbol.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Tue May 24 17:12:41 PDT 2016
Author: zturner
Date: Tue May 24 19:12:40 2016
New Revision: 270636
URL: http://llvm.org/viewvc/llvm-project?rev=270636&view=rev
Log:
[codeview] Add support for S_EXPORT symbol.
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/CVSymbolTypes.def
llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h
llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h
llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/CVSymbolTypes.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CVSymbolTypes.def?rev=270636&r1=270635&r2=270636&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/CVSymbolTypes.def (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/CVSymbolTypes.def Tue May 24 19:12:40 2016
@@ -159,7 +159,6 @@ CV_SYMBOL(S_SEPCODE , 0x1132)
CV_SYMBOL(S_LOCAL_2005 , 0x1133)
CV_SYMBOL(S_DEFRANGE_2005 , 0x1134)
CV_SYMBOL(S_DEFRANGE2_2005, 0x1135)
-CV_SYMBOL(S_EXPORT , 0x1138)
CV_SYMBOL(S_DISCARDED , 0x113b)
// Current symbol types for most procedures as of this writing.
@@ -194,6 +193,7 @@ SYMBOL_RECORD(S_THUNK32 , 0x1102,
SYMBOL_RECORD(S_TRAMPOLINE , 0x112c, TrampolineSym)
SYMBOL_RECORD(S_SECTION , 0x1136, SectionSym)
SYMBOL_RECORD(S_COFFGROUP , 0x1137, CoffGroupSym)
+SYMBOL_RECORD(S_EXPORT , 0x1138, ExportSym)
SYMBOL_RECORD(S_LPROC32 , 0x110f, ProcSym)
SYMBOL_RECORD_ALIAS(S_GPROC32 , 0x1110, GlobalProcSym, ProcSym)
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h?rev=270636&r1=270635&r2=270636&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/CodeView.h Tue May 24 19:12:40 2016
@@ -417,6 +417,7 @@ enum class CompileSym2Flags : uint32_t {
CVTCIL = 1 << 15,
MSILModule = 1 << 16,
};
+CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(CompileSym2Flags)
/// Corresponds to COMPILESYM3::Flags bitfield.
enum class CompileSym3Flags : uint32_t {
@@ -433,6 +434,17 @@ enum class CompileSym3Flags : uint32_t {
PGO = 1 << 18,
Exp = 1 << 19,
};
+CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(CompileSym3Flags)
+
+enum class ExportFlags : uint16_t {
+ IsConstant = 1 << 0,
+ IsData = 1 << 1,
+ IsPrivate = 1 << 2,
+ HasNoName = 1 << 3,
+ HasExplicitOrdinal = 1 << 4,
+ IsForwarder = 1 << 5
+};
+CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ExportFlags)
// Corresponds to BinaryAnnotationOpcode enum.
enum class BinaryAnnotationsOpCode : uint32_t {
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h?rev=270636&r1=270635&r2=270636&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h Tue May 24 19:12:40 2016
@@ -983,6 +983,34 @@ public:
std::vector<StringRef> Fields;
};
+// S_EXPORT
+class ExportSym : public SymbolRecord {
+public:
+ struct Hdr {
+ ulittle16_t Ordinal;
+ ulittle16_t Flags; // ExportFlags
+ // Name: The null-terminated name follows.
+ };
+
+ ExportSym(uint32_t RecordOffset, const Hdr *H, StringRef Name)
+ : SymbolRecord(SymbolRecordKind::ExportSym), RecordOffset(RecordOffset),
+ Header(*H), Name(Name) {}
+
+ static ErrorOr<ExportSym> deserialize(SymbolRecordKind Kind,
+ uint32_t RecordOffset,
+ ArrayRef<uint8_t> &Data) {
+ const Hdr *H = nullptr;
+ StringRef Name;
+ CV_DESERIALIZE(Data, H, Name);
+
+ return ExportSym(RecordOffset, H, Name);
+ }
+
+ uint32_t RecordOffset;
+ Hdr Header;
+ StringRef Name;
+};
+
// S_FILESTATIC
class FileStaticSym : public SymbolRecord {
public:
Modified: llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp?rev=270636&r1=270635&r2=270636&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp Tue May 24 19:12:40 2016
@@ -241,6 +241,15 @@ static const EnumEntry<uint32_t> FramePr
CV_ENUM_CLASS_ENT(FrameProcedureOptions, GuardCfw),
};
+static const EnumEntry<uint16_t> ExportSymFlags[] = {
+ CV_ENUM_CLASS_ENT(ExportFlags, IsConstant),
+ CV_ENUM_CLASS_ENT(ExportFlags, IsData),
+ CV_ENUM_CLASS_ENT(ExportFlags, IsPrivate),
+ CV_ENUM_CLASS_ENT(ExportFlags, HasNoName),
+ CV_ENUM_CLASS_ENT(ExportFlags, HasExplicitOrdinal),
+ CV_ENUM_CLASS_ENT(ExportFlags, IsForwarder),
+};
+
static const EnumEntry<uint8_t> ThunkOrdinalNames[] = {
CV_ENUM_CLASS_ENT(ThunkOrdinal, Standard),
CV_ENUM_CLASS_ENT(ThunkOrdinal, ThisAdjustor),
@@ -430,6 +439,13 @@ void CVSymbolDumperImpl::visitFileStatic
W.printString("Name", FileStatic.Name);
}
+void CVSymbolDumperImpl::visitExportSym(SymbolKind Kind, ExportSym &Export) {
+ DictScope S(W, "Export");
+ W.printNumber("Ordinal", Export.Header.Ordinal);
+ W.printFlags("Flags", Export.Header.Flags, makeArrayRef(ExportSymFlags));
+ W.printString("Name", Export.Name);
+}
+
void CVSymbolDumperImpl::visitCompile2Sym(SymbolKind Kind,
Compile2Sym &Compile2) {
DictScope S(W, "CompilerFlags2");
More information about the llvm-commits
mailing list