mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 06:10:12 +00:00
Move Object format code to lib/BinaryFormat.
This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
This commit is contained in:
parent
b4b16556e3
commit
264b5d9e88
@ -12,8 +12,8 @@
|
||||
#include "InputFiles.h"
|
||||
#include "Symbols.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/BinaryFormat/COFF.h"
|
||||
#include "llvm/Object/COFF.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "lld/Driver/Driver.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/BinaryFormat/Magic.h"
|
||||
#include "llvm/Object/ArchiveWriter.h"
|
||||
#include "llvm/Object/COFFImportFile.h"
|
||||
#include "llvm/Object/COFFModuleDefinition.h"
|
||||
@ -40,8 +41,6 @@ using namespace llvm;
|
||||
using namespace llvm::object;
|
||||
using namespace llvm::COFF;
|
||||
using llvm::sys::Process;
|
||||
using llvm::sys::fs::file_magic;
|
||||
using llvm::sys::fs::identify_magic;
|
||||
|
||||
namespace lld {
|
||||
namespace coff {
|
||||
|
@ -19,9 +19,9 @@
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/BinaryFormat/COFF.h"
|
||||
#include "llvm/Object/Binary.h"
|
||||
#include "llvm/Object/COFF.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
@ -13,9 +13,9 @@
|
||||
#include "llvm/ADT/MapVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/StringSet.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/Support/CachePruning.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
#include <vector>
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include "Relocations.h"
|
||||
#include "Strings.h"
|
||||
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/Object/ELF.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
@ -78,8 +78,8 @@
|
||||
#include "SymbolTable.h"
|
||||
#include "Threads.h"
|
||||
#include "llvm/ADT/Hashing.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/Object/ELF.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
|
||||
|
@ -17,13 +17,13 @@
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/IR/DiagnosticPrinter.h"
|
||||
#include "llvm/LTO/Caching.h"
|
||||
#include "llvm/LTO/Config.h"
|
||||
#include "llvm/LTO/LTO.h"
|
||||
#include "llvm/Object/SymbolicFile.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
|
@ -25,9 +25,9 @@
|
||||
#include "Writer.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Compression.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include "SymbolTable.h"
|
||||
#include "Writer.h"
|
||||
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/Object/ELF.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/MipsABIFlags.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "SyntheticSections.h"
|
||||
#include "Target.h"
|
||||
#include "Threads.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/Support/MD5.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/SHA1.h"
|
||||
|
@ -25,8 +25,8 @@
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
|
@ -27,9 +27,9 @@
|
||||
#include "Threads.h"
|
||||
#include "Writer.h"
|
||||
#include "lld/Config/Version.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h"
|
||||
#include "llvm/Object/ELFObjectFile.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/MD5.h"
|
||||
#include "llvm/Support/RandomNumberGenerator.h"
|
||||
|
@ -35,8 +35,8 @@
|
||||
#include "Thunks.h"
|
||||
#include "Writer.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/Object/ELF.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
@ -30,8 +30,8 @@
|
||||
#include "Symbols.h"
|
||||
#include "SyntheticSections.h"
|
||||
#include "Target.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
|
@ -13,14 +13,13 @@
|
||||
#include "lld/Core/LLVM.h"
|
||||
#include "lld/Core/Reference.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/Magic.h"
|
||||
#include "llvm/Support/ErrorOr.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
using llvm::sys::fs::file_magic;
|
||||
|
||||
namespace llvm {
|
||||
namespace yaml {
|
||||
class IO;
|
||||
@ -45,7 +44,7 @@ public:
|
||||
/// The method is called with:
|
||||
/// 1) the file_magic enumeration returned by identify_magic()
|
||||
/// 2) the whole file content buffer if the above is not enough.
|
||||
virtual bool canParse(file_magic magic, MemoryBufferRef mb) const = 0;
|
||||
virtual bool canParse(llvm::file_magic magic, MemoryBufferRef mb) const = 0;
|
||||
|
||||
/// \brief Parse a supplied buffer (already filled with the contents of a
|
||||
/// file) and create a File object.
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringSet.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include <set>
|
||||
|
||||
using llvm::MachO::HeaderFileType;
|
||||
|
@ -11,12 +11,16 @@
|
||||
#include "lld/Core/File.h"
|
||||
#include "lld/Core/Reference.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/Magic.h"
|
||||
#include "llvm/Support/Errc.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
using llvm::file_magic;
|
||||
using llvm::identify_magic;
|
||||
|
||||
namespace lld {
|
||||
|
||||
YamlIOTaggedDocumentHandler::~YamlIOTaggedDocumentHandler() = default;
|
||||
@ -33,7 +37,7 @@ ErrorOr<std::unique_ptr<File>>
|
||||
Registry::loadFile(std::unique_ptr<MemoryBuffer> mb) const {
|
||||
// Get file magic.
|
||||
StringRef content(mb->getBufferStart(), mb->getBufferSize());
|
||||
llvm::sys::fs::file_magic fileType = llvm::sys::fs::identify_magic(content);
|
||||
file_magic fileType = identify_magic(content);
|
||||
|
||||
// Ask each registered reader if it can handle this file type or extension.
|
||||
for (const std::unique_ptr<Reader> &reader : _readers) {
|
||||
|
@ -18,30 +18,30 @@
|
||||
#include "lld/Core/File.h"
|
||||
#include "lld/Core/Instrumentation.h"
|
||||
#include "lld/Core/LLVM.h"
|
||||
#include "lld/Core/LinkingContext.h"
|
||||
#include "lld/Core/Node.h"
|
||||
#include "lld/Core/PassManager.h"
|
||||
#include "lld/Core/Resolver.h"
|
||||
#include "lld/Core/SharedLibraryFile.h"
|
||||
#include "lld/Core/Simple.h"
|
||||
#include "lld/Core/LinkingContext.h"
|
||||
#include "lld/ReaderWriter/MachOLinkingContext.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Option/Arg.h"
|
||||
#include "llvm/Option/ArgList.h"
|
||||
#include "llvm/Option/Option.h"
|
||||
#include "llvm/Option/OptTable.h"
|
||||
#include "llvm/Option/Option.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/ErrorOr.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
|
@ -11,15 +11,16 @@
|
||||
#include "lld/Core/File.h"
|
||||
#include "lld/Core/LLVM.h"
|
||||
#include "lld/Core/Reader.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Object/Archive.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/Magic.h"
|
||||
#include "llvm/Object/Archive.h"
|
||||
#include "llvm/Object/Error.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorOr.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <memory>
|
||||
#include <set>
|
||||
@ -30,6 +31,8 @@
|
||||
#include <vector>
|
||||
|
||||
using llvm::object::Archive;
|
||||
using llvm::file_magic;
|
||||
using llvm::identify_magic;
|
||||
|
||||
namespace lld {
|
||||
|
||||
@ -201,7 +204,7 @@ public:
|
||||
ArchiveReader(bool logLoading) : _logLoading(logLoading) {}
|
||||
|
||||
bool canParse(file_magic magic, MemoryBufferRef) const override {
|
||||
return magic == llvm::sys::fs::file_magic::archive;
|
||||
return magic == file_magic::archive;
|
||||
}
|
||||
|
||||
ErrorOr<std::unique_ptr<File>> loadFile(std::unique_ptr<MemoryBuffer> mb,
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "Atoms.h"
|
||||
#include "File.h"
|
||||
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
|
||||
#include "lld/Core/DefinedAtom.h"
|
||||
#include "lld/Core/File.h"
|
||||
|
@ -22,11 +22,11 @@
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Demangle/Demangle.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Errc.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -48,10 +48,10 @@
|
||||
#include "lld/ReaderWriter/MachOLinkingContext.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorOr.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
|
||||
using llvm::BumpPtrAllocator;
|
||||
|
@ -21,24 +21,25 @@
|
||||
/// | normalized |
|
||||
/// +------------+
|
||||
|
||||
#include "MachONormalizedFile.h"
|
||||
#include "ArchHandler.h"
|
||||
#include "MachONormalizedFile.h"
|
||||
#include "MachONormalizedFileBinaryUtils.h"
|
||||
#include "lld/Core/Error.h"
|
||||
#include "lld/Core/LLVM.h"
|
||||
#include "lld/Core/SharedLibraryFile.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/BinaryFormat/Magic.h"
|
||||
#include "llvm/Object/MachO.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Errc.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FileOutputBuffer.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <functional>
|
||||
@ -46,6 +47,7 @@
|
||||
|
||||
using namespace llvm::MachO;
|
||||
using llvm::object::ExportEntry;
|
||||
using llvm::file_magic;
|
||||
using llvm::object::MachOObjectFile;
|
||||
|
||||
namespace lld {
|
||||
@ -531,8 +533,7 @@ public:
|
||||
MachOObjectReader(MachOLinkingContext &ctx) : _ctx(ctx) {}
|
||||
|
||||
bool canParse(file_magic magic, MemoryBufferRef mb) const override {
|
||||
return (magic == llvm::sys::fs::file_magic::macho_object &&
|
||||
mb.getBufferSize() > 32);
|
||||
return (magic == file_magic::macho_object && mb.getBufferSize() > 32);
|
||||
}
|
||||
|
||||
ErrorOr<std::unique_ptr<File>>
|
||||
@ -553,8 +554,8 @@ public:
|
||||
|
||||
bool canParse(file_magic magic, MemoryBufferRef mb) const override {
|
||||
switch (magic) {
|
||||
case llvm::sys::fs::file_magic::macho_dynamically_linked_shared_lib:
|
||||
case llvm::sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub:
|
||||
case file_magic::macho_dynamically_linked_shared_lib:
|
||||
case file_magic::macho_dynamically_linked_shared_lib_stub:
|
||||
return mb.getBufferSize() > 32;
|
||||
default:
|
||||
return false;
|
||||
|
@ -14,12 +14,12 @@
|
||||
#include "lld/Core/Error.h"
|
||||
#include "lld/Core/LLVM.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/Support/LEB128.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include <system_error>
|
||||
|
||||
namespace lld {
|
||||
|
@ -25,11 +25,12 @@
|
||||
#include "MachONormalizedFileBinaryUtils.h"
|
||||
#include "lld/Core/Error.h"
|
||||
#include "lld/Core/LLVM.h"
|
||||
#include "llvm/ADT/ilist.h"
|
||||
#include "llvm/ADT/ilist_node.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/ilist.h"
|
||||
#include "llvm/ADT/ilist_node.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Errc.h"
|
||||
@ -37,7 +38,6 @@
|
||||
#include "llvm/Support/FileOutputBuffer.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <functional>
|
||||
|
@ -20,19 +20,19 @@
|
||||
/// | Atoms |
|
||||
/// +-------+
|
||||
|
||||
#include "MachONormalizedFile.h"
|
||||
#include "ArchHandler.h"
|
||||
#include "DebugInfo.h"
|
||||
#include "MachONormalizedFile.h"
|
||||
#include "MachONormalizedFileBinaryUtils.h"
|
||||
#include "lld/Core/Error.h"
|
||||
#include "lld/Core/LLVM.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include <map>
|
||||
#include <system_error>
|
||||
#include <unordered_set>
|
||||
|
@ -20,20 +20,20 @@
|
||||
/// | Atoms |
|
||||
/// +-------+
|
||||
|
||||
#include "MachONormalizedFile.h"
|
||||
#include "ArchHandler.h"
|
||||
#include "Atoms.h"
|
||||
#include "File.h"
|
||||
#include "MachONormalizedFile.h"
|
||||
#include "MachONormalizedFileBinaryUtils.h"
|
||||
#include "lld/Core/Error.h"
|
||||
#include "lld/Core/LLVM.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/LEB128.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
|
@ -23,17 +23,16 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <system_error>
|
||||
|
||||
|
||||
using llvm::StringRef;
|
||||
using namespace llvm::yaml;
|
||||
using namespace llvm::MachO;
|
||||
|
@ -12,10 +12,10 @@
|
||||
#include "lld/Core/File.h"
|
||||
#include "lld/Core/Writer.h"
|
||||
#include "lld/ReaderWriter/MachOLinkingContext.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FileOutputBuffer.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <system_error>
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/BinaryFormat/Magic.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
@ -43,6 +44,7 @@
|
||||
#include <system_error>
|
||||
#include <vector>
|
||||
|
||||
using llvm::file_magic;
|
||||
using llvm::yaml::MappingTraits;
|
||||
using llvm::yaml::ScalarEnumerationTraits;
|
||||
using llvm::yaml::ScalarTraits;
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "lld/Driver/Driver.h"
|
||||
#include "lld/ReaderWriter/MachOLinkingContext.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
@ -7,14 +7,14 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "../../lib/ReaderWriter/MachO/MachONormalizedFile.h"
|
||||
#include "lld/ReaderWriter/MachOLinkingContext.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
|
@ -7,11 +7,11 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "../../lib/ReaderWriter/MachO/MachONormalizedFile.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <system_error>
|
||||
|
@ -7,7 +7,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "../../lib/ReaderWriter/MachO/MachONormalizedFile.h"
|
||||
#include "lld/Core/Atom.h"
|
||||
#include "lld/Core/DefinedAtom.h"
|
||||
@ -15,9 +14,10 @@
|
||||
#include "lld/Core/UndefinedAtom.h"
|
||||
#include "lld/ReaderWriter/MachOLinkingContext.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/YAMLTraits.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
|
@ -7,18 +7,18 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "../../lib/ReaderWriter/MachO/MachONormalizedFile.h"
|
||||
#include "lld/ReaderWriter/MachOLinkingContext.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <system_error>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
|
||||
using llvm::StringRef;
|
||||
using llvm::MemoryBuffer;
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
// Get the DWARF constant definitions from llvm
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
|
||||
#include "lldb/Core/RangeMap.h"
|
||||
|
||||
|
@ -114,6 +114,6 @@
|
||||
#undef CPU_SUBTYPE_MC980000_ALL
|
||||
#undef CPU_SUBTYPE_MC98601
|
||||
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
|
||||
#endif // liblldb_SafeMachO_h_
|
||||
|
@ -24,11 +24,11 @@
|
||||
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/Twine.h" // for Twine
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/Support/Compiler.h" // for LLVM_FALLTHROUGH
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/BinaryFormat/COFF.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/BinaryFormat/MachO.h" // for CPUType::CPU_T...
|
||||
#include "llvm/Support/Compiler.h" // for LLVM_FALLTHROUGH
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/Support/MachO.h" // for CPUType::CPU_T...
|
||||
|
||||
#include <memory> // for shared_ptr
|
||||
#include <string>
|
||||
|
@ -67,6 +67,7 @@ add_lldb_library(lldbCore
|
||||
lldbPluginObjectFileJIT
|
||||
|
||||
LINK_COMPONENTS
|
||||
BinaryFormat
|
||||
Support
|
||||
Demangle
|
||||
)
|
||||
|
@ -8,5 +8,6 @@ add_lldb_library(lldbPluginObjectFileELF PLUGIN
|
||||
lldbSymbol
|
||||
lldbTarget
|
||||
LINK_COMPONENTS
|
||||
BinaryFormat
|
||||
Support
|
||||
)
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef liblldb_ELFHeader_h_
|
||||
#define liblldb_ELFHeader_h_
|
||||
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
|
@ -8,5 +8,6 @@ add_lldb_library(lldbPluginObjectFilePECOFF PLUGIN
|
||||
lldbSymbol
|
||||
lldbTarget
|
||||
LINK_COMPONENTS
|
||||
BinaryFormat
|
||||
Support
|
||||
)
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "ObjectFilePECOFF.h"
|
||||
#include "WindowsMiniDump.h"
|
||||
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/BinaryFormat/COFF.h"
|
||||
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/FileSpecList.h"
|
||||
|
@ -17,5 +17,6 @@ add_lldb_library(lldbPluginProcessElfCore PLUGIN
|
||||
lldbPluginObjectFileELF
|
||||
lldbPluginProcessUtility
|
||||
LINK_COMPONENTS
|
||||
BinaryFormat
|
||||
Support
|
||||
)
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "lldb/Utility/DataBufferLLVM.h"
|
||||
#include "lldb/Utility/Log.h"
|
||||
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/Support/Threading.h"
|
||||
|
||||
#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
|
||||
|
@ -38,5 +38,6 @@ add_lldb_library(lldbUtility
|
||||
# lldbUtility cannot have any dependencies
|
||||
|
||||
LINK_COMPONENTS
|
||||
BinaryFormat
|
||||
Support
|
||||
)
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "lldb/Core/StructuredData.h"
|
||||
#include "lldb/Utility/StreamString.h"
|
||||
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
@ -49,7 +49,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/IR/Verifier.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/ExecutionEngine/MCJIT.h"
|
||||
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
@ -59,7 +59,7 @@
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/LegacyPassManager.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/IR/Verifier.h"
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
|
713
llvm/include/llvm/BinaryFormat/COFF.h
Normal file
713
llvm/include/llvm/BinaryFormat/COFF.h
Normal file
@ -0,0 +1,713 @@
|
||||
//===-- llvm/BinaryFormat/COFF.h --------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains an definitions used in Windows COFF Files.
|
||||
//
|
||||
// Structures and enums defined within this file where created using
|
||||
// information from Microsoft's publicly available PE/COFF format document:
|
||||
//
|
||||
// Microsoft Portable Executable and Common Object File Format Specification
|
||||
// Revision 8.1 - February 15, 2008
|
||||
//
|
||||
// As of 5/2/2010, hosted by Microsoft at:
|
||||
// http://www.microsoft.com/whdc/system/platform/firmware/pecoff.mspx
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_BINARYFORMAT_COFF_H
|
||||
#define LLVM_BINARYFORMAT_COFF_H
|
||||
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
namespace llvm {
|
||||
namespace COFF {
|
||||
|
||||
// The maximum number of sections that a COFF object can have (inclusive).
|
||||
const int32_t MaxNumberOfSections16 = 65279;
|
||||
|
||||
// The PE signature bytes that follows the DOS stub header.
|
||||
static const char PEMagic[] = {'P', 'E', '\0', '\0'};
|
||||
|
||||
static const char BigObjMagic[] = {
|
||||
'\xc7', '\xa1', '\xba', '\xd1', '\xee', '\xba', '\xa9', '\x4b',
|
||||
'\xaf', '\x20', '\xfa', '\xf6', '\x6a', '\xa4', '\xdc', '\xb8',
|
||||
};
|
||||
|
||||
static const char ClGlObjMagic[] = {
|
||||
'\x38', '\xfe', '\xb3', '\x0c', '\xa5', '\xd9', '\xab', '\x4d',
|
||||
'\xac', '\x9b', '\xd6', '\xb6', '\x22', '\x26', '\x53', '\xc2',
|
||||
};
|
||||
|
||||
// Sizes in bytes of various things in the COFF format.
|
||||
enum {
|
||||
Header16Size = 20,
|
||||
Header32Size = 56,
|
||||
NameSize = 8,
|
||||
Symbol16Size = 18,
|
||||
Symbol32Size = 20,
|
||||
SectionSize = 40,
|
||||
RelocationSize = 10
|
||||
};
|
||||
|
||||
struct header {
|
||||
uint16_t Machine;
|
||||
int32_t NumberOfSections;
|
||||
uint32_t TimeDateStamp;
|
||||
uint32_t PointerToSymbolTable;
|
||||
uint32_t NumberOfSymbols;
|
||||
uint16_t SizeOfOptionalHeader;
|
||||
uint16_t Characteristics;
|
||||
};
|
||||
|
||||
struct BigObjHeader {
|
||||
enum : uint16_t { MinBigObjectVersion = 2 };
|
||||
|
||||
uint16_t Sig1; ///< Must be IMAGE_FILE_MACHINE_UNKNOWN (0).
|
||||
uint16_t Sig2; ///< Must be 0xFFFF.
|
||||
uint16_t Version;
|
||||
uint16_t Machine;
|
||||
uint32_t TimeDateStamp;
|
||||
uint8_t UUID[16];
|
||||
uint32_t unused1;
|
||||
uint32_t unused2;
|
||||
uint32_t unused3;
|
||||
uint32_t unused4;
|
||||
uint32_t NumberOfSections;
|
||||
uint32_t PointerToSymbolTable;
|
||||
uint32_t NumberOfSymbols;
|
||||
};
|
||||
|
||||
enum MachineTypes {
|
||||
MT_Invalid = 0xffff,
|
||||
|
||||
IMAGE_FILE_MACHINE_UNKNOWN = 0x0,
|
||||
IMAGE_FILE_MACHINE_AM33 = 0x13,
|
||||
IMAGE_FILE_MACHINE_AMD64 = 0x8664,
|
||||
IMAGE_FILE_MACHINE_ARM = 0x1C0,
|
||||
IMAGE_FILE_MACHINE_ARMNT = 0x1C4,
|
||||
IMAGE_FILE_MACHINE_ARM64 = 0xAA64,
|
||||
IMAGE_FILE_MACHINE_EBC = 0xEBC,
|
||||
IMAGE_FILE_MACHINE_I386 = 0x14C,
|
||||
IMAGE_FILE_MACHINE_IA64 = 0x200,
|
||||
IMAGE_FILE_MACHINE_M32R = 0x9041,
|
||||
IMAGE_FILE_MACHINE_MIPS16 = 0x266,
|
||||
IMAGE_FILE_MACHINE_MIPSFPU = 0x366,
|
||||
IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466,
|
||||
IMAGE_FILE_MACHINE_POWERPC = 0x1F0,
|
||||
IMAGE_FILE_MACHINE_POWERPCFP = 0x1F1,
|
||||
IMAGE_FILE_MACHINE_R4000 = 0x166,
|
||||
IMAGE_FILE_MACHINE_SH3 = 0x1A2,
|
||||
IMAGE_FILE_MACHINE_SH3DSP = 0x1A3,
|
||||
IMAGE_FILE_MACHINE_SH4 = 0x1A6,
|
||||
IMAGE_FILE_MACHINE_SH5 = 0x1A8,
|
||||
IMAGE_FILE_MACHINE_THUMB = 0x1C2,
|
||||
IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
|
||||
};
|
||||
|
||||
enum Characteristics {
|
||||
C_Invalid = 0,
|
||||
|
||||
/// The file does not contain base relocations and must be loaded at its
|
||||
/// preferred base. If this cannot be done, the loader will error.
|
||||
IMAGE_FILE_RELOCS_STRIPPED = 0x0001,
|
||||
/// The file is valid and can be run.
|
||||
IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002,
|
||||
/// COFF line numbers have been stripped. This is deprecated and should be
|
||||
/// 0.
|
||||
IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004,
|
||||
/// COFF symbol table entries for local symbols have been removed. This is
|
||||
/// deprecated and should be 0.
|
||||
IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008,
|
||||
/// Aggressively trim working set. This is deprecated and must be 0.
|
||||
IMAGE_FILE_AGGRESSIVE_WS_TRIM = 0x0010,
|
||||
/// Image can handle > 2GiB addresses.
|
||||
IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020,
|
||||
/// Little endian: the LSB precedes the MSB in memory. This is deprecated
|
||||
/// and should be 0.
|
||||
IMAGE_FILE_BYTES_REVERSED_LO = 0x0080,
|
||||
/// Machine is based on a 32bit word architecture.
|
||||
IMAGE_FILE_32BIT_MACHINE = 0x0100,
|
||||
/// Debugging info has been removed.
|
||||
IMAGE_FILE_DEBUG_STRIPPED = 0x0200,
|
||||
/// If the image is on removable media, fully load it and copy it to swap.
|
||||
IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400,
|
||||
/// If the image is on network media, fully load it and copy it to swap.
|
||||
IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800,
|
||||
/// The image file is a system file, not a user program.
|
||||
IMAGE_FILE_SYSTEM = 0x1000,
|
||||
/// The image file is a DLL.
|
||||
IMAGE_FILE_DLL = 0x2000,
|
||||
/// This file should only be run on a uniprocessor machine.
|
||||
IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000,
|
||||
/// Big endian: the MSB precedes the LSB in memory. This is deprecated
|
||||
/// and should be 0.
|
||||
IMAGE_FILE_BYTES_REVERSED_HI = 0x8000
|
||||
};
|
||||
|
||||
enum ResourceTypeID {
|
||||
RID_Cursor = 1,
|
||||
RID_Bitmap = 2,
|
||||
RID_Icon = 3,
|
||||
RID_Menu = 4,
|
||||
RID_Dialog = 5,
|
||||
RID_String = 6,
|
||||
RID_FontDir = 7,
|
||||
RID_Font = 8,
|
||||
RID_Accelerator = 9,
|
||||
RID_RCData = 10,
|
||||
RID_MessageTable = 11,
|
||||
RID_Group_Cursor = 12,
|
||||
RID_Group_Icon = 14,
|
||||
RID_Version = 16,
|
||||
RID_DLGInclude = 17,
|
||||
RID_PlugPlay = 19,
|
||||
RID_VXD = 20,
|
||||
RID_AniCursor = 21,
|
||||
RID_AniIcon = 22,
|
||||
RID_HTML = 23,
|
||||
RID_Manifest = 24,
|
||||
};
|
||||
|
||||
struct symbol {
|
||||
char Name[NameSize];
|
||||
uint32_t Value;
|
||||
int32_t SectionNumber;
|
||||
uint16_t Type;
|
||||
uint8_t StorageClass;
|
||||
uint8_t NumberOfAuxSymbols;
|
||||
};
|
||||
|
||||
enum SymbolSectionNumber : int32_t {
|
||||
IMAGE_SYM_DEBUG = -2,
|
||||
IMAGE_SYM_ABSOLUTE = -1,
|
||||
IMAGE_SYM_UNDEFINED = 0
|
||||
};
|
||||
|
||||
/// Storage class tells where and what the symbol represents
|
||||
enum SymbolStorageClass {
|
||||
SSC_Invalid = 0xff,
|
||||
|
||||
IMAGE_SYM_CLASS_END_OF_FUNCTION = -1, ///< Physical end of function
|
||||
IMAGE_SYM_CLASS_NULL = 0, ///< No symbol
|
||||
IMAGE_SYM_CLASS_AUTOMATIC = 1, ///< Stack variable
|
||||
IMAGE_SYM_CLASS_EXTERNAL = 2, ///< External symbol
|
||||
IMAGE_SYM_CLASS_STATIC = 3, ///< Static
|
||||
IMAGE_SYM_CLASS_REGISTER = 4, ///< Register variable
|
||||
IMAGE_SYM_CLASS_EXTERNAL_DEF = 5, ///< External definition
|
||||
IMAGE_SYM_CLASS_LABEL = 6, ///< Label
|
||||
IMAGE_SYM_CLASS_UNDEFINED_LABEL = 7, ///< Undefined label
|
||||
IMAGE_SYM_CLASS_MEMBER_OF_STRUCT = 8, ///< Member of structure
|
||||
IMAGE_SYM_CLASS_ARGUMENT = 9, ///< Function argument
|
||||
IMAGE_SYM_CLASS_STRUCT_TAG = 10, ///< Structure tag
|
||||
IMAGE_SYM_CLASS_MEMBER_OF_UNION = 11, ///< Member of union
|
||||
IMAGE_SYM_CLASS_UNION_TAG = 12, ///< Union tag
|
||||
IMAGE_SYM_CLASS_TYPE_DEFINITION = 13, ///< Type definition
|
||||
IMAGE_SYM_CLASS_UNDEFINED_STATIC = 14, ///< Undefined static
|
||||
IMAGE_SYM_CLASS_ENUM_TAG = 15, ///< Enumeration tag
|
||||
IMAGE_SYM_CLASS_MEMBER_OF_ENUM = 16, ///< Member of enumeration
|
||||
IMAGE_SYM_CLASS_REGISTER_PARAM = 17, ///< Register parameter
|
||||
IMAGE_SYM_CLASS_BIT_FIELD = 18, ///< Bit field
|
||||
/// ".bb" or ".eb" - beginning or end of block
|
||||
IMAGE_SYM_CLASS_BLOCK = 100,
|
||||
/// ".bf" or ".ef" - beginning or end of function
|
||||
IMAGE_SYM_CLASS_FUNCTION = 101,
|
||||
IMAGE_SYM_CLASS_END_OF_STRUCT = 102, ///< End of structure
|
||||
IMAGE_SYM_CLASS_FILE = 103, ///< File name
|
||||
/// Line number, reformatted as symbol
|
||||
IMAGE_SYM_CLASS_SECTION = 104,
|
||||
IMAGE_SYM_CLASS_WEAK_EXTERNAL = 105, ///< Duplicate tag
|
||||
/// External symbol in dmert public lib
|
||||
IMAGE_SYM_CLASS_CLR_TOKEN = 107
|
||||
};
|
||||
|
||||
enum SymbolBaseType {
|
||||
IMAGE_SYM_TYPE_NULL = 0, ///< No type information or unknown base type.
|
||||
IMAGE_SYM_TYPE_VOID = 1, ///< Used with void pointers and functions.
|
||||
IMAGE_SYM_TYPE_CHAR = 2, ///< A character (signed byte).
|
||||
IMAGE_SYM_TYPE_SHORT = 3, ///< A 2-byte signed integer.
|
||||
IMAGE_SYM_TYPE_INT = 4, ///< A natural integer type on the target.
|
||||
IMAGE_SYM_TYPE_LONG = 5, ///< A 4-byte signed integer.
|
||||
IMAGE_SYM_TYPE_FLOAT = 6, ///< A 4-byte floating-point number.
|
||||
IMAGE_SYM_TYPE_DOUBLE = 7, ///< An 8-byte floating-point number.
|
||||
IMAGE_SYM_TYPE_STRUCT = 8, ///< A structure.
|
||||
IMAGE_SYM_TYPE_UNION = 9, ///< An union.
|
||||
IMAGE_SYM_TYPE_ENUM = 10, ///< An enumerated type.
|
||||
IMAGE_SYM_TYPE_MOE = 11, ///< A member of enumeration (a specific value).
|
||||
IMAGE_SYM_TYPE_BYTE = 12, ///< A byte; unsigned 1-byte integer.
|
||||
IMAGE_SYM_TYPE_WORD = 13, ///< A word; unsigned 2-byte integer.
|
||||
IMAGE_SYM_TYPE_UINT = 14, ///< An unsigned integer of natural size.
|
||||
IMAGE_SYM_TYPE_DWORD = 15 ///< An unsigned 4-byte integer.
|
||||
};
|
||||
|
||||
enum SymbolComplexType {
|
||||
IMAGE_SYM_DTYPE_NULL = 0, ///< No complex type; simple scalar variable.
|
||||
IMAGE_SYM_DTYPE_POINTER = 1, ///< A pointer to base type.
|
||||
IMAGE_SYM_DTYPE_FUNCTION = 2, ///< A function that returns a base type.
|
||||
IMAGE_SYM_DTYPE_ARRAY = 3, ///< An array of base type.
|
||||
|
||||
/// Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
|
||||
SCT_COMPLEX_TYPE_SHIFT = 4
|
||||
};
|
||||
|
||||
enum AuxSymbolType { IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1 };
|
||||
|
||||
struct section {
|
||||
char Name[NameSize];
|
||||
uint32_t VirtualSize;
|
||||
uint32_t VirtualAddress;
|
||||
uint32_t SizeOfRawData;
|
||||
uint32_t PointerToRawData;
|
||||
uint32_t PointerToRelocations;
|
||||
uint32_t PointerToLineNumbers;
|
||||
uint16_t NumberOfRelocations;
|
||||
uint16_t NumberOfLineNumbers;
|
||||
uint32_t Characteristics;
|
||||
};
|
||||
|
||||
enum SectionCharacteristics : uint32_t {
|
||||
SC_Invalid = 0xffffffff,
|
||||
|
||||
IMAGE_SCN_TYPE_NOLOAD = 0x00000002,
|
||||
IMAGE_SCN_TYPE_NO_PAD = 0x00000008,
|
||||
IMAGE_SCN_CNT_CODE = 0x00000020,
|
||||
IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040,
|
||||
IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080,
|
||||
IMAGE_SCN_LNK_OTHER = 0x00000100,
|
||||
IMAGE_SCN_LNK_INFO = 0x00000200,
|
||||
IMAGE_SCN_LNK_REMOVE = 0x00000800,
|
||||
IMAGE_SCN_LNK_COMDAT = 0x00001000,
|
||||
IMAGE_SCN_GPREL = 0x00008000,
|
||||
IMAGE_SCN_MEM_PURGEABLE = 0x00020000,
|
||||
IMAGE_SCN_MEM_16BIT = 0x00020000,
|
||||
IMAGE_SCN_MEM_LOCKED = 0x00040000,
|
||||
IMAGE_SCN_MEM_PRELOAD = 0x00080000,
|
||||
IMAGE_SCN_ALIGN_1BYTES = 0x00100000,
|
||||
IMAGE_SCN_ALIGN_2BYTES = 0x00200000,
|
||||
IMAGE_SCN_ALIGN_4BYTES = 0x00300000,
|
||||
IMAGE_SCN_ALIGN_8BYTES = 0x00400000,
|
||||
IMAGE_SCN_ALIGN_16BYTES = 0x00500000,
|
||||
IMAGE_SCN_ALIGN_32BYTES = 0x00600000,
|
||||
IMAGE_SCN_ALIGN_64BYTES = 0x00700000,
|
||||
IMAGE_SCN_ALIGN_128BYTES = 0x00800000,
|
||||
IMAGE_SCN_ALIGN_256BYTES = 0x00900000,
|
||||
IMAGE_SCN_ALIGN_512BYTES = 0x00A00000,
|
||||
IMAGE_SCN_ALIGN_1024BYTES = 0x00B00000,
|
||||
IMAGE_SCN_ALIGN_2048BYTES = 0x00C00000,
|
||||
IMAGE_SCN_ALIGN_4096BYTES = 0x00D00000,
|
||||
IMAGE_SCN_ALIGN_8192BYTES = 0x00E00000,
|
||||
IMAGE_SCN_LNK_NRELOC_OVFL = 0x01000000,
|
||||
IMAGE_SCN_MEM_DISCARDABLE = 0x02000000,
|
||||
IMAGE_SCN_MEM_NOT_CACHED = 0x04000000,
|
||||
IMAGE_SCN_MEM_NOT_PAGED = 0x08000000,
|
||||
IMAGE_SCN_MEM_SHARED = 0x10000000,
|
||||
IMAGE_SCN_MEM_EXECUTE = 0x20000000,
|
||||
IMAGE_SCN_MEM_READ = 0x40000000,
|
||||
IMAGE_SCN_MEM_WRITE = 0x80000000
|
||||
};
|
||||
|
||||
struct relocation {
|
||||
uint32_t VirtualAddress;
|
||||
uint32_t SymbolTableIndex;
|
||||
uint16_t Type;
|
||||
};
|
||||
|
||||
enum RelocationTypeI386 {
|
||||
IMAGE_REL_I386_ABSOLUTE = 0x0000,
|
||||
IMAGE_REL_I386_DIR16 = 0x0001,
|
||||
IMAGE_REL_I386_REL16 = 0x0002,
|
||||
IMAGE_REL_I386_DIR32 = 0x0006,
|
||||
IMAGE_REL_I386_DIR32NB = 0x0007,
|
||||
IMAGE_REL_I386_SEG12 = 0x0009,
|
||||
IMAGE_REL_I386_SECTION = 0x000A,
|
||||
IMAGE_REL_I386_SECREL = 0x000B,
|
||||
IMAGE_REL_I386_TOKEN = 0x000C,
|
||||
IMAGE_REL_I386_SECREL7 = 0x000D,
|
||||
IMAGE_REL_I386_REL32 = 0x0014
|
||||
};
|
||||
|
||||
enum RelocationTypeAMD64 {
|
||||
IMAGE_REL_AMD64_ABSOLUTE = 0x0000,
|
||||
IMAGE_REL_AMD64_ADDR64 = 0x0001,
|
||||
IMAGE_REL_AMD64_ADDR32 = 0x0002,
|
||||
IMAGE_REL_AMD64_ADDR32NB = 0x0003,
|
||||
IMAGE_REL_AMD64_REL32 = 0x0004,
|
||||
IMAGE_REL_AMD64_REL32_1 = 0x0005,
|
||||
IMAGE_REL_AMD64_REL32_2 = 0x0006,
|
||||
IMAGE_REL_AMD64_REL32_3 = 0x0007,
|
||||
IMAGE_REL_AMD64_REL32_4 = 0x0008,
|
||||
IMAGE_REL_AMD64_REL32_5 = 0x0009,
|
||||
IMAGE_REL_AMD64_SECTION = 0x000A,
|
||||
IMAGE_REL_AMD64_SECREL = 0x000B,
|
||||
IMAGE_REL_AMD64_SECREL7 = 0x000C,
|
||||
IMAGE_REL_AMD64_TOKEN = 0x000D,
|
||||
IMAGE_REL_AMD64_SREL32 = 0x000E,
|
||||
IMAGE_REL_AMD64_PAIR = 0x000F,
|
||||
IMAGE_REL_AMD64_SSPAN32 = 0x0010
|
||||
};
|
||||
|
||||
enum RelocationTypesARM {
|
||||
IMAGE_REL_ARM_ABSOLUTE = 0x0000,
|
||||
IMAGE_REL_ARM_ADDR32 = 0x0001,
|
||||
IMAGE_REL_ARM_ADDR32NB = 0x0002,
|
||||
IMAGE_REL_ARM_BRANCH24 = 0x0003,
|
||||
IMAGE_REL_ARM_BRANCH11 = 0x0004,
|
||||
IMAGE_REL_ARM_TOKEN = 0x0005,
|
||||
IMAGE_REL_ARM_BLX24 = 0x0008,
|
||||
IMAGE_REL_ARM_BLX11 = 0x0009,
|
||||
IMAGE_REL_ARM_SECTION = 0x000E,
|
||||
IMAGE_REL_ARM_SECREL = 0x000F,
|
||||
IMAGE_REL_ARM_MOV32A = 0x0010,
|
||||
IMAGE_REL_ARM_MOV32T = 0x0011,
|
||||
IMAGE_REL_ARM_BRANCH20T = 0x0012,
|
||||
IMAGE_REL_ARM_BRANCH24T = 0x0014,
|
||||
IMAGE_REL_ARM_BLX23T = 0x0015
|
||||
};
|
||||
|
||||
enum RelocationTypesARM64 {
|
||||
IMAGE_REL_ARM64_ABSOLUTE = 0x0000,
|
||||
IMAGE_REL_ARM64_ADDR32 = 0x0001,
|
||||
IMAGE_REL_ARM64_ADDR32NB = 0x0002,
|
||||
IMAGE_REL_ARM64_BRANCH26 = 0x0003,
|
||||
IMAGE_REL_ARM64_PAGEBASE_REL2 = 0x0004,
|
||||
IMAGE_REL_ARM64_REL21 = 0x0005,
|
||||
IMAGE_REL_ARM64_PAGEOFFSET_12A = 0x0006,
|
||||
IMAGE_REL_ARM64_PAGEOFFSET_12L = 0x0007,
|
||||
IMAGE_REL_ARM64_SECREL = 0x0008,
|
||||
IMAGE_REL_ARM64_SECREL_LOW12A = 0x0009,
|
||||
IMAGE_REL_ARM64_SECREL_HIGH12A = 0x000A,
|
||||
IMAGE_REL_ARM64_SECREL_LOW12L = 0x000B,
|
||||
IMAGE_REL_ARM64_TOKEN = 0x000C,
|
||||
IMAGE_REL_ARM64_SECTION = 0x000D,
|
||||
IMAGE_REL_ARM64_ADDR64 = 0x000E,
|
||||
IMAGE_REL_ARM64_BRANCH19 = 0x000F,
|
||||
IMAGE_REL_ARM64_BRANCH14 = 0x0010,
|
||||
};
|
||||
|
||||
enum COMDATType {
|
||||
IMAGE_COMDAT_SELECT_NODUPLICATES = 1,
|
||||
IMAGE_COMDAT_SELECT_ANY,
|
||||
IMAGE_COMDAT_SELECT_SAME_SIZE,
|
||||
IMAGE_COMDAT_SELECT_EXACT_MATCH,
|
||||
IMAGE_COMDAT_SELECT_ASSOCIATIVE,
|
||||
IMAGE_COMDAT_SELECT_LARGEST,
|
||||
IMAGE_COMDAT_SELECT_NEWEST
|
||||
};
|
||||
|
||||
// Auxiliary Symbol Formats
|
||||
struct AuxiliaryFunctionDefinition {
|
||||
uint32_t TagIndex;
|
||||
uint32_t TotalSize;
|
||||
uint32_t PointerToLinenumber;
|
||||
uint32_t PointerToNextFunction;
|
||||
char unused[2];
|
||||
};
|
||||
|
||||
struct AuxiliarybfAndefSymbol {
|
||||
uint8_t unused1[4];
|
||||
uint16_t Linenumber;
|
||||
uint8_t unused2[6];
|
||||
uint32_t PointerToNextFunction;
|
||||
uint8_t unused3[2];
|
||||
};
|
||||
|
||||
struct AuxiliaryWeakExternal {
|
||||
uint32_t TagIndex;
|
||||
uint32_t Characteristics;
|
||||
uint8_t unused[10];
|
||||
};
|
||||
|
||||
enum WeakExternalCharacteristics {
|
||||
IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY = 1,
|
||||
IMAGE_WEAK_EXTERN_SEARCH_LIBRARY = 2,
|
||||
IMAGE_WEAK_EXTERN_SEARCH_ALIAS = 3
|
||||
};
|
||||
|
||||
struct AuxiliarySectionDefinition {
|
||||
uint32_t Length;
|
||||
uint16_t NumberOfRelocations;
|
||||
uint16_t NumberOfLinenumbers;
|
||||
uint32_t CheckSum;
|
||||
uint32_t Number;
|
||||
uint8_t Selection;
|
||||
char unused;
|
||||
};
|
||||
|
||||
struct AuxiliaryCLRToken {
|
||||
uint8_t AuxType;
|
||||
uint8_t unused1;
|
||||
uint32_t SymbolTableIndex;
|
||||
char unused2[12];
|
||||
};
|
||||
|
||||
union Auxiliary {
|
||||
AuxiliaryFunctionDefinition FunctionDefinition;
|
||||
AuxiliarybfAndefSymbol bfAndefSymbol;
|
||||
AuxiliaryWeakExternal WeakExternal;
|
||||
AuxiliarySectionDefinition SectionDefinition;
|
||||
};
|
||||
|
||||
/// @brief The Import Directory Table.
|
||||
///
|
||||
/// There is a single array of these and one entry per imported DLL.
|
||||
struct ImportDirectoryTableEntry {
|
||||
uint32_t ImportLookupTableRVA;
|
||||
uint32_t TimeDateStamp;
|
||||
uint32_t ForwarderChain;
|
||||
uint32_t NameRVA;
|
||||
uint32_t ImportAddressTableRVA;
|
||||
};
|
||||
|
||||
/// @brief The PE32 Import Lookup Table.
|
||||
///
|
||||
/// There is an array of these for each imported DLL. It represents either
|
||||
/// the ordinal to import from the target DLL, or a name to lookup and import
|
||||
/// from the target DLL.
|
||||
///
|
||||
/// This also happens to be the same format used by the Import Address Table
|
||||
/// when it is initially written out to the image.
|
||||
struct ImportLookupTableEntry32 {
|
||||
uint32_t data;
|
||||
|
||||
/// @brief Is this entry specified by ordinal, or name?
|
||||
bool isOrdinal() const { return data & 0x80000000; }
|
||||
|
||||
/// @brief Get the ordinal value of this entry. isOrdinal must be true.
|
||||
uint16_t getOrdinal() const {
|
||||
assert(isOrdinal() && "ILT entry is not an ordinal!");
|
||||
return data & 0xFFFF;
|
||||
}
|
||||
|
||||
/// @brief Set the ordinal value and set isOrdinal to true.
|
||||
void setOrdinal(uint16_t o) {
|
||||
data = o;
|
||||
data |= 0x80000000;
|
||||
}
|
||||
|
||||
/// @brief Get the Hint/Name entry RVA. isOrdinal must be false.
|
||||
uint32_t getHintNameRVA() const {
|
||||
assert(!isOrdinal() && "ILT entry is not a Hint/Name RVA!");
|
||||
return data;
|
||||
}
|
||||
|
||||
/// @brief Set the Hint/Name entry RVA and set isOrdinal to false.
|
||||
void setHintNameRVA(uint32_t rva) { data = rva; }
|
||||
};
|
||||
|
||||
/// @brief The DOS compatible header at the front of all PEs.
|
||||
struct DOSHeader {
|
||||
uint16_t Magic;
|
||||
uint16_t UsedBytesInTheLastPage;
|
||||
uint16_t FileSizeInPages;
|
||||
uint16_t NumberOfRelocationItems;
|
||||
uint16_t HeaderSizeInParagraphs;
|
||||
uint16_t MinimumExtraParagraphs;
|
||||
uint16_t MaximumExtraParagraphs;
|
||||
uint16_t InitialRelativeSS;
|
||||
uint16_t InitialSP;
|
||||
uint16_t Checksum;
|
||||
uint16_t InitialIP;
|
||||
uint16_t InitialRelativeCS;
|
||||
uint16_t AddressOfRelocationTable;
|
||||
uint16_t OverlayNumber;
|
||||
uint16_t Reserved[4];
|
||||
uint16_t OEMid;
|
||||
uint16_t OEMinfo;
|
||||
uint16_t Reserved2[10];
|
||||
uint32_t AddressOfNewExeHeader;
|
||||
};
|
||||
|
||||
struct PE32Header {
|
||||
enum { PE32 = 0x10b, PE32_PLUS = 0x20b };
|
||||
|
||||
uint16_t Magic;
|
||||
uint8_t MajorLinkerVersion;
|
||||
uint8_t MinorLinkerVersion;
|
||||
uint32_t SizeOfCode;
|
||||
uint32_t SizeOfInitializedData;
|
||||
uint32_t SizeOfUninitializedData;
|
||||
uint32_t AddressOfEntryPoint; // RVA
|
||||
uint32_t BaseOfCode; // RVA
|
||||
uint32_t BaseOfData; // RVA
|
||||
uint32_t ImageBase;
|
||||
uint32_t SectionAlignment;
|
||||
uint32_t FileAlignment;
|
||||
uint16_t MajorOperatingSystemVersion;
|
||||
uint16_t MinorOperatingSystemVersion;
|
||||
uint16_t MajorImageVersion;
|
||||
uint16_t MinorImageVersion;
|
||||
uint16_t MajorSubsystemVersion;
|
||||
uint16_t MinorSubsystemVersion;
|
||||
uint32_t Win32VersionValue;
|
||||
uint32_t SizeOfImage;
|
||||
uint32_t SizeOfHeaders;
|
||||
uint32_t CheckSum;
|
||||
uint16_t Subsystem;
|
||||
// FIXME: This should be DllCharacteristics to match the COFF spec.
|
||||
uint16_t DLLCharacteristics;
|
||||
uint32_t SizeOfStackReserve;
|
||||
uint32_t SizeOfStackCommit;
|
||||
uint32_t SizeOfHeapReserve;
|
||||
uint32_t SizeOfHeapCommit;
|
||||
uint32_t LoaderFlags;
|
||||
// FIXME: This should be NumberOfRvaAndSizes to match the COFF spec.
|
||||
uint32_t NumberOfRvaAndSize;
|
||||
};
|
||||
|
||||
struct DataDirectory {
|
||||
uint32_t RelativeVirtualAddress;
|
||||
uint32_t Size;
|
||||
};
|
||||
|
||||
enum DataDirectoryIndex {
|
||||
EXPORT_TABLE = 0,
|
||||
IMPORT_TABLE,
|
||||
RESOURCE_TABLE,
|
||||
EXCEPTION_TABLE,
|
||||
CERTIFICATE_TABLE,
|
||||
BASE_RELOCATION_TABLE,
|
||||
DEBUG_DIRECTORY,
|
||||
ARCHITECTURE,
|
||||
GLOBAL_PTR,
|
||||
TLS_TABLE,
|
||||
LOAD_CONFIG_TABLE,
|
||||
BOUND_IMPORT,
|
||||
IAT,
|
||||
DELAY_IMPORT_DESCRIPTOR,
|
||||
CLR_RUNTIME_HEADER,
|
||||
|
||||
NUM_DATA_DIRECTORIES
|
||||
};
|
||||
|
||||
enum WindowsSubsystem {
|
||||
IMAGE_SUBSYSTEM_UNKNOWN = 0, ///< An unknown subsystem.
|
||||
IMAGE_SUBSYSTEM_NATIVE = 1, ///< Device drivers and native Windows processes
|
||||
IMAGE_SUBSYSTEM_WINDOWS_GUI = 2, ///< The Windows GUI subsystem.
|
||||
IMAGE_SUBSYSTEM_WINDOWS_CUI = 3, ///< The Windows character subsystem.
|
||||
IMAGE_SUBSYSTEM_OS2_CUI = 5, ///< The OS/2 character subsytem.
|
||||
IMAGE_SUBSYSTEM_POSIX_CUI = 7, ///< The POSIX character subsystem.
|
||||
IMAGE_SUBSYSTEM_NATIVE_WINDOWS = 8, ///< Native Windows 9x driver.
|
||||
IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9, ///< Windows CE.
|
||||
IMAGE_SUBSYSTEM_EFI_APPLICATION = 10, ///< An EFI application.
|
||||
IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11, ///< An EFI driver with boot
|
||||
/// services.
|
||||
IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12, ///< An EFI driver with run-time
|
||||
/// services.
|
||||
IMAGE_SUBSYSTEM_EFI_ROM = 13, ///< An EFI ROM image.
|
||||
IMAGE_SUBSYSTEM_XBOX = 14, ///< XBOX.
|
||||
IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16 ///< A BCD application.
|
||||
};
|
||||
|
||||
enum DLLCharacteristics {
|
||||
/// ASLR with 64 bit address space.
|
||||
IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA = 0x0020,
|
||||
/// DLL can be relocated at load time.
|
||||
IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE = 0x0040,
|
||||
/// Code integrity checks are enforced.
|
||||
IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY = 0x0080,
|
||||
///< Image is NX compatible.
|
||||
IMAGE_DLL_CHARACTERISTICS_NX_COMPAT = 0x0100,
|
||||
/// Isolation aware, but do not isolate the image.
|
||||
IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION = 0x0200,
|
||||
/// Does not use structured exception handling (SEH). No SEH handler may be
|
||||
/// called in this image.
|
||||
IMAGE_DLL_CHARACTERISTICS_NO_SEH = 0x0400,
|
||||
/// Do not bind the image.
|
||||
IMAGE_DLL_CHARACTERISTICS_NO_BIND = 0x0800,
|
||||
///< Image should execute in an AppContainer.
|
||||
IMAGE_DLL_CHARACTERISTICS_APPCONTAINER = 0x1000,
|
||||
///< A WDM driver.
|
||||
IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER = 0x2000,
|
||||
///< Image supports Control Flow Guard.
|
||||
IMAGE_DLL_CHARACTERISTICS_GUARD_CF = 0x4000,
|
||||
/// Terminal Server aware.
|
||||
IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000
|
||||
};
|
||||
|
||||
enum DebugType {
|
||||
IMAGE_DEBUG_TYPE_UNKNOWN = 0,
|
||||
IMAGE_DEBUG_TYPE_COFF = 1,
|
||||
IMAGE_DEBUG_TYPE_CODEVIEW = 2,
|
||||
IMAGE_DEBUG_TYPE_FPO = 3,
|
||||
IMAGE_DEBUG_TYPE_MISC = 4,
|
||||
IMAGE_DEBUG_TYPE_EXCEPTION = 5,
|
||||
IMAGE_DEBUG_TYPE_FIXUP = 6,
|
||||
IMAGE_DEBUG_TYPE_OMAP_TO_SRC = 7,
|
||||
IMAGE_DEBUG_TYPE_OMAP_FROM_SRC = 8,
|
||||
IMAGE_DEBUG_TYPE_BORLAND = 9,
|
||||
IMAGE_DEBUG_TYPE_RESERVED10 = 10,
|
||||
IMAGE_DEBUG_TYPE_CLSID = 11,
|
||||
IMAGE_DEBUG_TYPE_VC_FEATURE = 12,
|
||||
IMAGE_DEBUG_TYPE_POGO = 13,
|
||||
IMAGE_DEBUG_TYPE_ILTCG = 14,
|
||||
IMAGE_DEBUG_TYPE_MPX = 15,
|
||||
IMAGE_DEBUG_TYPE_REPRO = 16,
|
||||
};
|
||||
|
||||
enum BaseRelocationType {
|
||||
IMAGE_REL_BASED_ABSOLUTE = 0,
|
||||
IMAGE_REL_BASED_HIGH = 1,
|
||||
IMAGE_REL_BASED_LOW = 2,
|
||||
IMAGE_REL_BASED_HIGHLOW = 3,
|
||||
IMAGE_REL_BASED_HIGHADJ = 4,
|
||||
IMAGE_REL_BASED_MIPS_JMPADDR = 5,
|
||||
IMAGE_REL_BASED_ARM_MOV32A = 5,
|
||||
IMAGE_REL_BASED_ARM_MOV32T = 7,
|
||||
IMAGE_REL_BASED_MIPS_JMPADDR16 = 9,
|
||||
IMAGE_REL_BASED_DIR64 = 10
|
||||
};
|
||||
|
||||
enum ImportType { IMPORT_CODE = 0, IMPORT_DATA = 1, IMPORT_CONST = 2 };
|
||||
|
||||
enum ImportNameType {
|
||||
/// Import is by ordinal. This indicates that the value in the Ordinal/Hint
|
||||
/// field of the import header is the import's ordinal. If this constant is
|
||||
/// not specified, then the Ordinal/Hint field should always be interpreted
|
||||
/// as the import's hint.
|
||||
IMPORT_ORDINAL = 0,
|
||||
/// The import name is identical to the public symbol name
|
||||
IMPORT_NAME = 1,
|
||||
/// The import name is the public symbol name, but skipping the leading ?,
|
||||
/// @, or optionally _.
|
||||
IMPORT_NAME_NOPREFIX = 2,
|
||||
/// The import name is the public symbol name, but skipping the leading ?,
|
||||
/// @, or optionally _, and truncating at the first @.
|
||||
IMPORT_NAME_UNDECORATE = 3
|
||||
};
|
||||
|
||||
struct ImportHeader {
|
||||
uint16_t Sig1; ///< Must be IMAGE_FILE_MACHINE_UNKNOWN (0).
|
||||
uint16_t Sig2; ///< Must be 0xFFFF.
|
||||
uint16_t Version;
|
||||
uint16_t Machine;
|
||||
uint32_t TimeDateStamp;
|
||||
uint32_t SizeOfData;
|
||||
uint16_t OrdinalHint;
|
||||
uint16_t TypeInfo;
|
||||
|
||||
ImportType getType() const { return static_cast<ImportType>(TypeInfo & 0x3); }
|
||||
|
||||
ImportNameType getNameType() const {
|
||||
return static_cast<ImportNameType>((TypeInfo & 0x1C) >> 2);
|
||||
}
|
||||
};
|
||||
|
||||
enum CodeViewIdentifiers {
|
||||
DEBUG_SECTION_MAGIC = 0x4,
|
||||
};
|
||||
|
||||
inline bool isReservedSectionNumber(int32_t SectionNumber) {
|
||||
return SectionNumber <= 0;
|
||||
}
|
||||
|
||||
} // End namespace COFF.
|
||||
} // End namespace llvm.
|
||||
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/Support/Dwarf.h ---Dwarf Constants------------------*- C++ -*-===//
|
||||
//===-- llvm/BinaryFormat/Dwarf.h ---Dwarf Constants-------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -17,8 +17,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_SUPPORT_DWARF_H
|
||||
#define LLVM_SUPPORT_DWARF_H
|
||||
#ifndef LLVM_BINARYFORMAT_DWARF_H
|
||||
#define LLVM_BINARYFORMAT_DWARF_H
|
||||
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
@ -37,7 +37,7 @@ namespace dwarf {
|
||||
// enumeration base type.
|
||||
|
||||
enum LLVMConstants : uint32_t {
|
||||
// LLVM mock tags (see also llvm/Support/Dwarf.def).
|
||||
// LLVM mock tags (see also llvm/BinaryFormat/Dwarf.def).
|
||||
DW_TAG_invalid = ~0U, // Tag for invalid results.
|
||||
DW_VIRTUALITY_invalid = ~0U, // Virtuality for invalid results.
|
||||
DW_MACINFO_invalid = ~0U, // Macinfo type for invalid results.
|
||||
@ -48,7 +48,7 @@ enum LLVMConstants : uint32_t {
|
||||
DW_PUBNAMES_VERSION = 2, // Section version number for .debug_pubnames.
|
||||
DW_ARANGES_VERSION = 2, // Section version number for .debug_aranges.
|
||||
// Identifiers we use to distinguish vendor extensions.
|
||||
DWARF_VENDOR_DWARF = 0, // Defined in v2 or later of the DWARF standard.
|
||||
DWARF_VENDOR_DWARF = 0, // Defined in v2 or later of the DWARF standard.
|
||||
DWARF_VENDOR_APPLE = 1,
|
||||
DWARF_VENDOR_BORLAND = 2,
|
||||
DWARF_VENDOR_GNU = 3,
|
||||
@ -64,7 +64,7 @@ const uint64_t DW64_CIE_ID = UINT64_MAX;
|
||||
|
||||
enum Tag : uint16_t {
|
||||
#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) DW_TAG_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_TAG_lo_user = 0x4080,
|
||||
DW_TAG_hi_user = 0xffff,
|
||||
DW_TAG_user_base = 0x1000 // Recommended base for user tags.
|
||||
@ -101,20 +101,20 @@ inline bool isType(Tag T) {
|
||||
/// Attributes.
|
||||
enum Attribute : uint16_t {
|
||||
#define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) DW_AT_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_AT_lo_user = 0x2000,
|
||||
DW_AT_hi_user = 0x3fff,
|
||||
};
|
||||
|
||||
enum Form : uint16_t {
|
||||
#define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) DW_FORM_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
DW_FORM_lo_user = 0x1f00, ///< Not specified by DWARF.
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_FORM_lo_user = 0x1f00, ///< Not specified by DWARF.
|
||||
};
|
||||
|
||||
enum LocationAtom {
|
||||
#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) DW_OP_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_OP_lo_user = 0xe0,
|
||||
DW_OP_hi_user = 0xff,
|
||||
DW_OP_LLVM_fragment = 0x1000 ///< Only used in LLVM metadata.
|
||||
@ -122,7 +122,7 @@ enum LocationAtom {
|
||||
|
||||
enum TypeKind {
|
||||
#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) DW_ATE_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_ATE_lo_user = 0x80,
|
||||
DW_ATE_hi_user = 0xff
|
||||
};
|
||||
@ -161,19 +161,19 @@ enum VisibilityAttribute {
|
||||
|
||||
enum VirtualityAttribute {
|
||||
#define HANDLE_DW_VIRTUALITY(ID, NAME) DW_VIRTUALITY_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_VIRTUALITY_max = 0x02
|
||||
};
|
||||
|
||||
enum DefaultedMemberAttribute {
|
||||
#define HANDLE_DW_DEFAULTED(ID, NAME) DW_DEFAULTED_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_DEFAULTED_max = 0x02
|
||||
};
|
||||
|
||||
enum SourceLanguage {
|
||||
#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR) DW_LANG_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_LANG_lo_user = 0x8000,
|
||||
DW_LANG_hi_user = 0xffff
|
||||
};
|
||||
@ -187,9 +187,9 @@ enum CaseSensitivity {
|
||||
};
|
||||
|
||||
enum CallingConvention {
|
||||
// Calling convention codes
|
||||
// Calling convention codes
|
||||
#define HANDLE_DW_CC(ID, NAME) DW_CC_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_CC_lo_user = 0x40,
|
||||
DW_CC_hi_user = 0xff
|
||||
};
|
||||
@ -217,20 +217,20 @@ enum DiscriminantList {
|
||||
/// Line Number Standard Opcode Encodings.
|
||||
enum LineNumberOps : uint8_t {
|
||||
#define HANDLE_DW_LNS(ID, NAME) DW_LNS_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
};
|
||||
|
||||
/// Line Number Extended Opcode Encodings.
|
||||
enum LineNumberExtendedOps {
|
||||
#define HANDLE_DW_LNE(ID, NAME) DW_LNE_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_LNE_lo_user = 0x80,
|
||||
DW_LNE_hi_user = 0xff
|
||||
};
|
||||
|
||||
enum LineNumberEntryFormat {
|
||||
#define HANDLE_DW_LNCT(ID, NAME) DW_LNCT_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_LNCT_lo_user = 0x2000,
|
||||
DW_LNCT_hi_user = 0x3fff,
|
||||
};
|
||||
@ -247,7 +247,7 @@ enum MacinfoRecordType {
|
||||
/// DWARF v5 macro information entry type encodings.
|
||||
enum MacroEntryType {
|
||||
#define HANDLE_DW_MACRO(ID, NAME) DW_MACRO_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_MACRO_lo_user = 0xe0,
|
||||
DW_MACRO_hi_user = 0xff
|
||||
};
|
||||
@ -255,14 +255,13 @@ enum MacroEntryType {
|
||||
/// DWARF v5 range list entry encoding values.
|
||||
enum RangeListEntries {
|
||||
#define HANDLE_DW_RLE(ID, NAME) DW_RLE_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
};
|
||||
|
||||
|
||||
/// Call frame instruction encodings.
|
||||
enum CallFrameInfo {
|
||||
#define HANDLE_DW_CFA(ID, NAME) DW_CFA_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_CFA_extended = 0x00,
|
||||
|
||||
DW_CFA_lo_user = 0x1c,
|
||||
@ -310,13 +309,13 @@ enum LocationListEntry : unsigned char {
|
||||
/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
|
||||
enum ApplePropertyAttributes {
|
||||
#define HANDLE_DW_APPLE_PROPERTY(ID, NAME) DW_APPLE_PROPERTY_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
};
|
||||
|
||||
/// Constants for unit types in DWARF v5.
|
||||
enum UnitType : unsigned char {
|
||||
#define HANDLE_DW_UT(ID, NAME) DW_UT_##NAME = ID,
|
||||
#include "llvm/Support/Dwarf.def"
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
DW_UT_lo_user = 0x80,
|
||||
DW_UT_hi_user = 0xff
|
||||
};
|
||||
@ -355,10 +354,7 @@ enum GDBIndexEntryKind {
|
||||
GIEK_UNUSED7
|
||||
};
|
||||
|
||||
enum GDBIndexEntryLinkage {
|
||||
GIEL_EXTERNAL,
|
||||
GIEL_STATIC
|
||||
};
|
||||
enum GDBIndexEntryLinkage { GIEL_EXTERNAL, GIEL_STATIC };
|
||||
|
||||
/// \defgroup DwarfConstantsDumping Dwarf constants dumping functions
|
||||
///
|
||||
@ -470,8 +466,8 @@ struct PubIndexEntryDescriptor {
|
||||
/* implicit */ PubIndexEntryDescriptor(GDBIndexEntryKind Kind)
|
||||
: Kind(Kind), Linkage(GIEL_EXTERNAL) {}
|
||||
explicit PubIndexEntryDescriptor(uint8_t Value)
|
||||
: Kind(static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >>
|
||||
KIND_OFFSET)),
|
||||
: Kind(
|
||||
static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >> KIND_OFFSET)),
|
||||
Linkage(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
|
||||
LINKAGE_OFFSET)) {}
|
||||
uint8_t toBits() const {
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/Support/ELF.h - ELF constants and data structures --*- C++ -*-===//
|
||||
//===-- llvm/BinaryFormat/ELF.h - ELF constants and structures --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -17,8 +17,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_SUPPORT_ELF_H
|
||||
#define LLVM_SUPPORT_ELF_H
|
||||
#ifndef LLVM_BINARYFORMAT_ELF_H
|
||||
#define LLVM_BINARYFORMAT_ELF_H
|
||||
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
1984
llvm/include/llvm/BinaryFormat/MachO.h
Normal file
1984
llvm/include/llvm/BinaryFormat/MachO.h
Normal file
File diff suppressed because it is too large
Load Diff
71
llvm/include/llvm/BinaryFormat/Magic.h
Normal file
71
llvm/include/llvm/BinaryFormat/Magic.h
Normal file
@ -0,0 +1,71 @@
|
||||
//===- llvm/BinaryFormat/Magic.h - File magic identification ----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_BINARYFORMAT_MAGIC_H
|
||||
#define LLVM_BINARYFORMAT_MAGIC_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
|
||||
namespace llvm {
|
||||
/// file_magic - An "enum class" enumeration of file types based on magic (the
|
||||
/// first N bytes of the file).
|
||||
struct file_magic {
|
||||
enum Impl {
|
||||
unknown = 0, ///< Unrecognized file
|
||||
bitcode, ///< Bitcode file
|
||||
archive, ///< ar style archive file
|
||||
elf, ///< ELF Unknown type
|
||||
elf_relocatable, ///< ELF Relocatable object file
|
||||
elf_executable, ///< ELF Executable image
|
||||
elf_shared_object, ///< ELF dynamically linked shared lib
|
||||
elf_core, ///< ELF core image
|
||||
macho_object, ///< Mach-O Object file
|
||||
macho_executable, ///< Mach-O Executable
|
||||
macho_fixed_virtual_memory_shared_lib, ///< Mach-O Shared Lib, FVM
|
||||
macho_core, ///< Mach-O Core File
|
||||
macho_preload_executable, ///< Mach-O Preloaded Executable
|
||||
macho_dynamically_linked_shared_lib, ///< Mach-O dynlinked shared lib
|
||||
macho_dynamic_linker, ///< The Mach-O dynamic linker
|
||||
macho_bundle, ///< Mach-O Bundle file
|
||||
macho_dynamically_linked_shared_lib_stub, ///< Mach-O Shared lib stub
|
||||
macho_dsym_companion, ///< Mach-O dSYM companion file
|
||||
macho_kext_bundle, ///< Mach-O kext bundle file
|
||||
macho_universal_binary, ///< Mach-O universal binary
|
||||
coff_cl_gl_object, ///< Microsoft cl.exe's intermediate code file
|
||||
coff_object, ///< COFF object file
|
||||
coff_import_library, ///< COFF import library
|
||||
pecoff_executable, ///< PECOFF executable file
|
||||
windows_resource, ///< Windows compiled resource file (.res)
|
||||
wasm_object ///< WebAssembly Object file
|
||||
};
|
||||
|
||||
bool is_object() const { return V != unknown; }
|
||||
|
||||
file_magic() = default;
|
||||
file_magic(Impl V) : V(V) {}
|
||||
operator Impl() const { return V; }
|
||||
|
||||
private:
|
||||
Impl V = unknown;
|
||||
};
|
||||
|
||||
/// @brief Identify the type of a binary file based on how magical it is.
|
||||
file_magic identify_magic(StringRef magic);
|
||||
|
||||
/// @brief Get and identify \a path's type based on its content.
|
||||
///
|
||||
/// @param path Input path.
|
||||
/// @param result Set to the type of file, or file_magic::unknown.
|
||||
/// @returns errc::success if result has been successfully set, otherwise a
|
||||
/// platform-specific error_code.
|
||||
std::error_code identify_magic(const Twine &path, file_magic &result);
|
||||
} // namespace llvm
|
||||
|
||||
#endif
|
@ -12,8 +12,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_SUPPORT_WASM_H
|
||||
#define LLVM_SUPPORT_WASM_H
|
||||
#ifndef LLVM_BINARYFORMAT_WASM_H
|
||||
#define LLVM_BINARYFORMAT_WASM_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
|
||||
@ -106,10 +106,10 @@ struct WasmElemSegment {
|
||||
};
|
||||
|
||||
struct WasmRelocation {
|
||||
uint32_t Type; // The type of the relocation.
|
||||
int32_t Index; // Index into function to global index space.
|
||||
uint64_t Offset; // Offset from the start of the section.
|
||||
int64_t Addend; // A value to add to the symbol.
|
||||
uint32_t Type; // The type of the relocation.
|
||||
int32_t Index; // Index into function to global index space.
|
||||
uint64_t Offset; // Offset from the start of the section.
|
||||
int64_t Addend; // A value to add to the symbol.
|
||||
};
|
||||
|
||||
enum : unsigned {
|
||||
@ -129,36 +129,36 @@ enum : unsigned {
|
||||
|
||||
// Type immediate encodings used in various contexts.
|
||||
enum {
|
||||
WASM_TYPE_I32 = -0x01,
|
||||
WASM_TYPE_I64 = -0x02,
|
||||
WASM_TYPE_F32 = -0x03,
|
||||
WASM_TYPE_F64 = -0x04,
|
||||
WASM_TYPE_ANYFUNC = -0x10,
|
||||
WASM_TYPE_FUNC = -0x20,
|
||||
WASM_TYPE_NORESULT = -0x40, // for blocks with no result values
|
||||
WASM_TYPE_I32 = -0x01,
|
||||
WASM_TYPE_I64 = -0x02,
|
||||
WASM_TYPE_F32 = -0x03,
|
||||
WASM_TYPE_F64 = -0x04,
|
||||
WASM_TYPE_ANYFUNC = -0x10,
|
||||
WASM_TYPE_FUNC = -0x20,
|
||||
WASM_TYPE_NORESULT = -0x40, // for blocks with no result values
|
||||
};
|
||||
|
||||
// Kinds of externals (for imports and exports).
|
||||
enum : unsigned {
|
||||
WASM_EXTERNAL_FUNCTION = 0x0,
|
||||
WASM_EXTERNAL_TABLE = 0x1,
|
||||
WASM_EXTERNAL_MEMORY = 0x2,
|
||||
WASM_EXTERNAL_GLOBAL = 0x3,
|
||||
WASM_EXTERNAL_TABLE = 0x1,
|
||||
WASM_EXTERNAL_MEMORY = 0x2,
|
||||
WASM_EXTERNAL_GLOBAL = 0x3,
|
||||
};
|
||||
|
||||
// Opcodes used in initializer expressions.
|
||||
enum : unsigned {
|
||||
WASM_OPCODE_END = 0x0b,
|
||||
WASM_OPCODE_END = 0x0b,
|
||||
WASM_OPCODE_GET_GLOBAL = 0x23,
|
||||
WASM_OPCODE_I32_CONST = 0x41,
|
||||
WASM_OPCODE_I64_CONST = 0x42,
|
||||
WASM_OPCODE_F32_CONST = 0x43,
|
||||
WASM_OPCODE_F64_CONST = 0x44,
|
||||
WASM_OPCODE_I32_CONST = 0x41,
|
||||
WASM_OPCODE_I64_CONST = 0x42,
|
||||
WASM_OPCODE_F32_CONST = 0x43,
|
||||
WASM_OPCODE_F64_CONST = 0x44,
|
||||
};
|
||||
|
||||
enum : unsigned {
|
||||
WASM_NAMES_FUNCTION = 0x1,
|
||||
WASM_NAMES_LOCAL = 0x2,
|
||||
WASM_NAMES_FUNCTION = 0x1,
|
||||
WASM_NAMES_LOCAL = 0x2,
|
||||
};
|
||||
|
||||
enum : unsigned {
|
@ -21,10 +21,10 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/CodeGen/DwarfStringPoolEntry.h"
|
||||
#include "llvm/Support/AlignOf.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
@ -15,9 +15,9 @@
|
||||
#ifndef LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
|
||||
#define LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
|
||||
|
||||
#include "llvm/BinaryFormat/Wasm.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/CodeGen/ValueTypes.h"
|
||||
#include "llvm/Support/Wasm.h"
|
||||
|
||||
namespace llvm {
|
||||
class MCSymbol;
|
||||
|
@ -11,8 +11,8 @@
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_ENUMTABLES_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/BinaryFormat/COFF.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/Support/ScopedPrinter.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
@ -11,9 +11,9 @@
|
||||
#define LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H
|
||||
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
|
@ -10,8 +10,8 @@
|
||||
#ifndef LLVM_DEBUGINFO_DWARFATTRIBUTE_H
|
||||
#define LLVM_DEBUGINFO_DWARFATTRIBUTE_H
|
||||
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
|
@ -10,8 +10,8 @@
|
||||
#ifndef LLVM_DEBUGINFO_DWARFDEBUGINFOENTRY_H
|
||||
#define LLVM_DEBUGINFO_DWARFDEBUGINFOENTRY_H
|
||||
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
|
@ -14,11 +14,11 @@
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/iterator.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DIContext.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFAttribute.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
|
||||
@ -24,7 +25,6 @@
|
||||
#include "llvm/Object/Binary.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
|
@ -22,9 +22,9 @@
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
#include <cstddef>
|
||||
@ -148,7 +148,7 @@ public:
|
||||
/// Tagged DWARF-like metadata node.
|
||||
///
|
||||
/// A metadata node with a DWARF tag (i.e., a constant named \c DW_TAG_*,
|
||||
/// defined in llvm/Support/Dwarf.h). Called \a DINode because it's
|
||||
/// defined in llvm/BinaryFormat/Dwarf.h). Called \a DINode because it's
|
||||
/// potentially used for non-DWARF output.
|
||||
class DINode : public MDNode {
|
||||
friend class LLVMContextImpl;
|
||||
@ -2642,7 +2642,8 @@ public:
|
||||
/// Macro Info DWARF-like metadata node.
|
||||
///
|
||||
/// A metadata node with a DWARF macro info (i.e., a constant named
|
||||
/// \c DW_MACINFO_*, defined in llvm/Support/Dwarf.h). Called \a DIMacroNode
|
||||
/// \c DW_MACINFO_*, defined in llvm/BinaryFormat/Dwarf.h). Called \a
|
||||
/// DIMacroNode
|
||||
/// because it's potentially used for non-DWARF output.
|
||||
class DIMacroNode : public MDNode {
|
||||
friend class LLVMContextImpl;
|
||||
|
@ -16,13 +16,13 @@
|
||||
#ifndef LLVM_LINKALLIR_H
|
||||
#define LLVM_LINKALLIR_H
|
||||
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Verifier.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/Support/DynamicLibrary.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/Memory.h"
|
||||
|
@ -17,12 +17,12 @@
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
#include "llvm/MC/SectionKind.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
@ -11,8 +11,8 @@
|
||||
#define LLVM_MC_MCELFOBJECTWRITER_H
|
||||
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
@ -12,11 +12,11 @@
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCObjectWriter.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/StringTableBuilder.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -15,8 +15,8 @@
|
||||
#define LLVM_MC_MCSECTIONMACHO_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -9,8 +9,8 @@
|
||||
#ifndef LLVM_MC_MCSYMBOLWASM_H
|
||||
#define LLVM_MC_MCSYMBOLWASM_H
|
||||
|
||||
#include "llvm/BinaryFormat/Wasm.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/Support/Wasm.h"
|
||||
|
||||
namespace llvm {
|
||||
class MCSymbolWasm : public MCSymbol {
|
||||
|
@ -11,10 +11,10 @@
|
||||
#define LLVM_MC_MCWASMOBJECTWRITER_H
|
||||
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/BinaryFormat/Wasm.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Support/Wasm.h"
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
@ -15,13 +15,13 @@
|
||||
#define LLVM_OBJECT_COFF_H
|
||||
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/BinaryFormat/COFF.h"
|
||||
#include "llvm/DebugInfo/CodeView/CVDebugRecord.h"
|
||||
#include "llvm/MC/SubtargetFeature.h"
|
||||
#include "llvm/Object/Binary.h"
|
||||
#include "llvm/Object/Error.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Support/BinaryByteStream.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/Support/ConvertUTF.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
@ -17,9 +17,9 @@
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/Object/ELFTypes.h"
|
||||
#include "llvm/Object/Error.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cassert>
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/MC/SubtargetFeature.h"
|
||||
#include "llvm/Object/Binary.h"
|
||||
#include "llvm/Object/ELF.h"
|
||||
@ -29,7 +30,6 @@
|
||||
#include "llvm/Support/ARMAttributeParser.h"
|
||||
#include "llvm/Support/ARMBuildAttributes.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/Object/Error.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cassert>
|
||||
|
@ -22,13 +22,13 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/MC/SubtargetFeature.h"
|
||||
#include "llvm/Object/Binary.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Object/SymbolicFile.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cstdint>
|
||||
|
@ -16,10 +16,10 @@
|
||||
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
#include "llvm/Object/Archive.h"
|
||||
#include "llvm/Object/Binary.h"
|
||||
#include "llvm/Object/MachO.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
|
||||
namespace llvm {
|
||||
class StringRef;
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/BinaryFormat/Magic.h"
|
||||
#include "llvm/MC/SubtargetFeature.h"
|
||||
#include "llvm/Object/Binary.h"
|
||||
#include "llvm/Object/Error.h"
|
||||
@ -306,10 +307,10 @@ public:
|
||||
createObjectFile(StringRef ObjectPath);
|
||||
|
||||
static Expected<std::unique_ptr<ObjectFile>>
|
||||
createObjectFile(MemoryBufferRef Object, sys::fs::file_magic Type);
|
||||
createObjectFile(MemoryBufferRef Object, llvm::file_magic Type);
|
||||
static Expected<std::unique_ptr<ObjectFile>>
|
||||
createObjectFile(MemoryBufferRef Object) {
|
||||
return createObjectFile(Object, sys::fs::file_magic::unknown);
|
||||
return createObjectFile(Object, llvm::file_magic::unknown);
|
||||
}
|
||||
|
||||
static inline bool classof(const Binary *v) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user