summaryrefslogtreecommitdiff
path: root/include/llvm/Object/COFFYAML.h
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-03-19 04:47:47 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-03-19 04:47:47 +0000
commit6d191534f63b0ece222e2d6e418144b123c81c0c (patch)
tree72a8ca1b42f1f5c47cdeff5a5593c7b2ffcc8d58 /include/llvm/Object/COFFYAML.h
parent92c5a193e0d17f4b70f507ff976aac6a44962041 (diff)
downloadllvm-6d191534f63b0ece222e2d6e418144b123c81c0c.tar.gz
llvm-6d191534f63b0ece222e2d6e418144b123c81c0c.tar.bz2
llvm-6d191534f63b0ece222e2d6e418144b123c81c0c.tar.xz
Object: Provide a richer means of describing auxiliary symbols
The current state of affairs has auxiliary symbols described as a big bag of bytes. This is less than satisfying, it detracts from the YAML file as being human readable. Instead, allow for symbols to optionally contain their auxiliary data. This allows us to have a much higher level way of describing things like weak symbols, function definitions and section definitions. This depends on D3105. Differential Revision: http://llvm-reviews.chandlerc.com/D3092 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204214 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Object/COFFYAML.h')
-rw-r--r--include/llvm/Object/COFFYAML.h47
1 files changed, 46 insertions, 1 deletions
diff --git a/include/llvm/Object/COFFYAML.h b/include/llvm/Object/COFFYAML.h
index 3fa3ec6c12..b5f9cccf85 100644
--- a/include/llvm/Object/COFFYAML.h
+++ b/include/llvm/Object/COFFYAML.h
@@ -14,6 +14,7 @@
#ifndef LLVM_OBJECT_COFFYAML_H
#define LLVM_OBJECT_COFFYAML_H
+#include "llvm/ADT/Optional.h"
#include "llvm/Object/YAML.h"
#include "llvm/Support/COFF.h"
@@ -35,6 +36,10 @@ inline SectionCharacteristics operator|(SectionCharacteristics a,
// The structure of the yaml files is not an exact 1:1 match to COFF. In order
// to use yaml::IO, we use these structures which are closer to the source.
namespace COFFYAML {
+ LLVM_YAML_STRONG_TYPEDEF(uint8_t, COMDATType)
+ LLVM_YAML_STRONG_TYPEDEF(uint32_t, WeakExternalCharacteristics)
+ LLVM_YAML_STRONG_TYPEDEF(uint8_t, AuxSymbolType)
+
struct Relocation {
uint32_t VirtualAddress;
uint16_t Type;
@@ -54,7 +59,12 @@ namespace COFFYAML {
COFF::symbol Header;
COFF::SymbolBaseType SimpleType;
COFF::SymbolComplexType ComplexType;
- object::yaml::BinaryRef AuxiliaryData;
+ Optional<COFF::AuxiliaryFunctionDefinition> FunctionDefinition;
+ Optional<COFF::AuxiliarybfAndefSymbol> bfAndefSymbol;
+ Optional<COFF::AuxiliaryWeakExternal> WeakExternal;
+ StringRef File;
+ Optional<COFF::AuxiliarySectionDefinition> SectionDefinition;
+ Optional<COFF::AuxiliaryCLRToken> CLRToken;
StringRef Name;
Symbol();
};
@@ -76,6 +86,21 @@ namespace llvm {
namespace yaml {
template <>
+struct ScalarEnumerationTraits<COFFYAML::WeakExternalCharacteristics> {
+ static void enumeration(IO &IO, COFFYAML::WeakExternalCharacteristics &Value);
+};
+
+template <>
+struct ScalarEnumerationTraits<COFFYAML::AuxSymbolType> {
+ static void enumeration(IO &IO, COFFYAML::AuxSymbolType &Value);
+};
+
+template <>
+struct ScalarEnumerationTraits<COFFYAML::COMDATType> {
+ static void enumeration(IO &IO, COFFYAML::COMDATType &Value);
+};
+
+template <>
struct ScalarEnumerationTraits<COFF::MachineTypes> {
static void enumeration(IO &IO, COFF::MachineTypes &Value);
};
@@ -120,6 +145,26 @@ struct MappingTraits<COFF::header> {
static void mapping(IO &IO, COFF::header &H);
};
+template <> struct MappingTraits<COFF::AuxiliaryFunctionDefinition> {
+ static void mapping(IO &IO, COFF::AuxiliaryFunctionDefinition &AFD);
+};
+
+template <> struct MappingTraits<COFF::AuxiliarybfAndefSymbol> {
+ static void mapping(IO &IO, COFF::AuxiliarybfAndefSymbol &AAS);
+};
+
+template <> struct MappingTraits<COFF::AuxiliaryWeakExternal> {
+ static void mapping(IO &IO, COFF::AuxiliaryWeakExternal &AWE);
+};
+
+template <> struct MappingTraits<COFF::AuxiliarySectionDefinition> {
+ static void mapping(IO &IO, COFF::AuxiliarySectionDefinition &ASD);
+};
+
+template <> struct MappingTraits<COFF::AuxiliaryCLRToken> {
+ static void mapping(IO &IO, COFF::AuxiliaryCLRToken &ACT);
+};
+
template <>
struct MappingTraits<COFFYAML::Symbol> {
static void mapping(IO &IO, COFFYAML::Symbol &S);