[XCOFF] Add functionality for parsing AIX XCOFF object file headers
Summary:
1. Add functionality for parsing AIX XCOFF object files headers.
2. Only support 32-bit AIX XCOFF object files in this patch.
3. Print out the AIX XCOFF object file header in YAML format.
Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk
Reviewed By: sfertile, hubert.reinterpretcast
Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59419
Patch by Digger Lin
llvm-svn: 357663
2019-04-04 02:53:21 +02:00
|
|
|
//===----- XCOFFYAML.h - XCOFF YAMLIO implementation ------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares classes for handling the YAML representation of XCOFF.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_OBJECTYAML_XCOFFYAML_H
|
|
|
|
#define LLVM_OBJECTYAML_XCOFFYAML_H
|
|
|
|
|
2019-05-28 16:37:59 +02:00
|
|
|
#include "llvm/BinaryFormat/XCOFF.h"
|
[XCOFF] Add functionality for parsing AIX XCOFF object file headers
Summary:
1. Add functionality for parsing AIX XCOFF object files headers.
2. Only support 32-bit AIX XCOFF object files in this patch.
3. Print out the AIX XCOFF object file header in YAML format.
Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk
Reviewed By: sfertile, hubert.reinterpretcast
Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59419
Patch by Digger Lin
llvm-svn: 357663
2019-04-04 02:53:21 +02:00
|
|
|
#include "llvm/ObjectYAML/YAML.h"
|
2019-05-28 16:37:59 +02:00
|
|
|
#include <vector>
|
[XCOFF] Add functionality for parsing AIX XCOFF object file headers
Summary:
1. Add functionality for parsing AIX XCOFF object files headers.
2. Only support 32-bit AIX XCOFF object files in this patch.
3. Print out the AIX XCOFF object file header in YAML format.
Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk
Reviewed By: sfertile, hubert.reinterpretcast
Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59419
Patch by Digger Lin
llvm-svn: 357663
2019-04-04 02:53:21 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace XCOFFYAML {
|
|
|
|
|
|
|
|
struct FileHeader {
|
|
|
|
llvm::yaml::Hex16 Magic;
|
|
|
|
uint16_t NumberOfSections;
|
|
|
|
int32_t TimeStamp;
|
2021-06-07 06:14:44 +02:00
|
|
|
llvm::yaml::Hex64 SymbolTableOffset;
|
|
|
|
uint32_t NumberOfSymTableEntries;
|
[XCOFF] Add functionality for parsing AIX XCOFF object file headers
Summary:
1. Add functionality for parsing AIX XCOFF object files headers.
2. Only support 32-bit AIX XCOFF object files in this patch.
3. Print out the AIX XCOFF object file header in YAML format.
Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk
Reviewed By: sfertile, hubert.reinterpretcast
Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59419
Patch by Digger Lin
llvm-svn: 357663
2019-04-04 02:53:21 +02:00
|
|
|
uint16_t AuxHeaderSize;
|
|
|
|
llvm::yaml::Hex16 Flags;
|
|
|
|
};
|
|
|
|
|
2021-06-07 06:14:44 +02:00
|
|
|
struct Relocation {
|
|
|
|
llvm::yaml::Hex64 VirtualAddress;
|
|
|
|
llvm::yaml::Hex64 SymbolIndex;
|
|
|
|
llvm::yaml::Hex8 Info;
|
|
|
|
llvm::yaml::Hex8 Type;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Section {
|
|
|
|
StringRef SectionName;
|
|
|
|
llvm::yaml::Hex64 Address;
|
|
|
|
llvm::yaml::Hex64 Size;
|
|
|
|
llvm::yaml::Hex64 FileOffsetToData;
|
|
|
|
llvm::yaml::Hex64 FileOffsetToRelocations;
|
|
|
|
llvm::yaml::Hex64 FileOffsetToLineNumbers; // Line number pointer. Not supported yet.
|
|
|
|
llvm::yaml::Hex16 NumberOfRelocations;
|
|
|
|
llvm::yaml::Hex16 NumberOfLineNumbers; // Line number counts. Not supported yet.
|
|
|
|
uint32_t Flags;
|
|
|
|
yaml::BinaryRef SectionData;
|
|
|
|
std::vector<Relocation> Relocations;
|
|
|
|
};
|
|
|
|
|
2019-05-28 16:37:59 +02:00
|
|
|
struct Symbol {
|
|
|
|
StringRef SymbolName;
|
2021-06-07 06:14:44 +02:00
|
|
|
llvm::yaml::Hex64 Value; // Symbol value; storage class-dependent.
|
2019-05-28 16:37:59 +02:00
|
|
|
StringRef SectionName;
|
|
|
|
llvm::yaml::Hex16 Type;
|
|
|
|
XCOFF::StorageClass StorageClass;
|
2021-06-07 06:14:44 +02:00
|
|
|
uint8_t NumberOfAuxEntries;
|
2019-05-28 16:37:59 +02:00
|
|
|
};
|
|
|
|
|
[XCOFF] Add functionality for parsing AIX XCOFF object file headers
Summary:
1. Add functionality for parsing AIX XCOFF object files headers.
2. Only support 32-bit AIX XCOFF object files in this patch.
3. Print out the AIX XCOFF object file header in YAML format.
Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk
Reviewed By: sfertile, hubert.reinterpretcast
Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59419
Patch by Digger Lin
llvm-svn: 357663
2019-04-04 02:53:21 +02:00
|
|
|
struct Object {
|
|
|
|
FileHeader Header;
|
2021-06-07 06:14:44 +02:00
|
|
|
std::vector<Section> Sections;
|
2019-05-28 16:37:59 +02:00
|
|
|
std::vector<Symbol> Symbols;
|
[XCOFF] Add functionality for parsing AIX XCOFF object file headers
Summary:
1. Add functionality for parsing AIX XCOFF object files headers.
2. Only support 32-bit AIX XCOFF object files in this patch.
3. Print out the AIX XCOFF object file header in YAML format.
Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk
Reviewed By: sfertile, hubert.reinterpretcast
Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59419
Patch by Digger Lin
llvm-svn: 357663
2019-04-04 02:53:21 +02:00
|
|
|
Object();
|
|
|
|
};
|
|
|
|
} // namespace XCOFFYAML
|
2019-05-28 16:37:59 +02:00
|
|
|
} // namespace llvm
|
2021-06-07 06:14:44 +02:00
|
|
|
|
2019-05-28 16:37:59 +02:00
|
|
|
LLVM_YAML_IS_SEQUENCE_VECTOR(XCOFFYAML::Symbol)
|
2021-06-07 06:14:44 +02:00
|
|
|
LLVM_YAML_IS_SEQUENCE_VECTOR(XCOFFYAML::Relocation)
|
|
|
|
LLVM_YAML_IS_SEQUENCE_VECTOR(XCOFFYAML::Section)
|
|
|
|
|
2019-05-28 16:37:59 +02:00
|
|
|
namespace llvm {
|
[XCOFF] Add functionality for parsing AIX XCOFF object file headers
Summary:
1. Add functionality for parsing AIX XCOFF object files headers.
2. Only support 32-bit AIX XCOFF object files in this patch.
3. Print out the AIX XCOFF object file header in YAML format.
Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk
Reviewed By: sfertile, hubert.reinterpretcast
Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59419
Patch by Digger Lin
llvm-svn: 357663
2019-04-04 02:53:21 +02:00
|
|
|
namespace yaml {
|
|
|
|
|
2021-06-07 06:14:44 +02:00
|
|
|
template <> struct ScalarBitSetTraits<XCOFF::SectionTypeFlags> {
|
|
|
|
static void bitset(IO &IO, XCOFF::SectionTypeFlags &Value);
|
|
|
|
};
|
|
|
|
|
2019-05-28 16:37:59 +02:00
|
|
|
template <> struct ScalarEnumerationTraits<XCOFF::StorageClass> {
|
|
|
|
static void enumeration(IO &IO, XCOFF::StorageClass &Value);
|
|
|
|
};
|
|
|
|
|
[XCOFF] Add functionality for parsing AIX XCOFF object file headers
Summary:
1. Add functionality for parsing AIX XCOFF object files headers.
2. Only support 32-bit AIX XCOFF object files in this patch.
3. Print out the AIX XCOFF object file header in YAML format.
Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk
Reviewed By: sfertile, hubert.reinterpretcast
Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59419
Patch by Digger Lin
llvm-svn: 357663
2019-04-04 02:53:21 +02:00
|
|
|
template <> struct MappingTraits<XCOFFYAML::FileHeader> {
|
|
|
|
static void mapping(IO &IO, XCOFFYAML::FileHeader &H);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-05-28 16:37:59 +02:00
|
|
|
template <> struct MappingTraits<XCOFFYAML::Symbol> {
|
|
|
|
static void mapping(IO &IO, XCOFFYAML::Symbol &S);
|
|
|
|
};
|
|
|
|
|
2021-06-07 06:14:44 +02:00
|
|
|
template <> struct MappingTraits<XCOFFYAML::Relocation> {
|
|
|
|
static void mapping(IO &IO, XCOFFYAML::Relocation &R);
|
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct MappingTraits<XCOFFYAML::Section> {
|
|
|
|
static void mapping(IO &IO, XCOFFYAML::Section &Sec);
|
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct MappingTraits<XCOFFYAML::Object> {
|
|
|
|
static void mapping(IO &IO, XCOFFYAML::Object &Obj);
|
|
|
|
};
|
|
|
|
|
[XCOFF] Add functionality for parsing AIX XCOFF object file headers
Summary:
1. Add functionality for parsing AIX XCOFF object files headers.
2. Only support 32-bit AIX XCOFF object files in this patch.
3. Print out the AIX XCOFF object file header in YAML format.
Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk
Reviewed By: sfertile, hubert.reinterpretcast
Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59419
Patch by Digger Lin
llvm-svn: 357663
2019-04-04 02:53:21 +02:00
|
|
|
} // namespace yaml
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
#endif // LLVM_OBJECTYAML_XCOFFYAML_H
|