2014-11-19 10:21:53 +08:00
|
|
|
//===- lib/ReaderWriter/MachO/MachONormalizedFile.h -----------------------===//
|
2013-10-08 08:43:34 +08:00
|
|
|
//
|
|
|
|
// The LLVM Linker
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
///
|
|
|
|
/// \file These data structures comprise the "normalized" view of
|
|
|
|
/// mach-o object files. The normalized view is an in-memory only data structure
|
2014-01-27 11:09:26 +08:00
|
|
|
/// which is always in native endianness and pointer size.
|
|
|
|
///
|
|
|
|
/// The normalized view easily converts to and from YAML using YAML I/O.
|
2013-10-08 08:43:34 +08:00
|
|
|
///
|
|
|
|
/// The normalized view converts to and from binary mach-o object files using
|
|
|
|
/// the writeBinary() and readBinary() functions.
|
|
|
|
///
|
2014-01-27 11:09:26 +08:00
|
|
|
/// The normalized view converts to and from lld::Atoms using the
|
2013-10-08 08:43:34 +08:00
|
|
|
/// normalizedToAtoms() and normalizedFromAtoms().
|
|
|
|
///
|
|
|
|
/// Overall, the conversion paths available look like:
|
|
|
|
///
|
2014-01-27 11:09:26 +08:00
|
|
|
/// +---------------+
|
|
|
|
/// | binary mach-o |
|
|
|
|
/// +---------------+
|
2013-10-08 08:43:34 +08:00
|
|
|
/// ^
|
|
|
|
/// |
|
|
|
|
/// v
|
2014-01-27 11:09:26 +08:00
|
|
|
/// +------------+ +------+
|
|
|
|
/// | normalized | <-> | yaml |
|
|
|
|
/// +------------+ +------+
|
2013-10-08 08:43:34 +08:00
|
|
|
/// ^
|
|
|
|
/// |
|
|
|
|
/// v
|
2014-01-27 11:09:26 +08:00
|
|
|
/// +-------+
|
2013-10-08 08:43:34 +08:00
|
|
|
/// | Atoms |
|
2014-01-27 11:09:26 +08:00
|
|
|
/// +-------+
|
|
|
|
///
|
2013-10-08 08:43:34 +08:00
|
|
|
|
2016-02-09 05:50:45 +08:00
|
|
|
#ifndef LLD_READER_WRITER_MACHO_NORMALIZE_FILE_H
|
|
|
|
#define LLD_READER_WRITER_MACHO_NORMALIZE_FILE_H
|
|
|
|
|
2016-07-28 06:55:30 +08:00
|
|
|
#include "DebugInfo.h"
|
2017-10-03 05:00:41 +08:00
|
|
|
#include "lld/Common/LLVM.h"
|
2013-10-08 08:43:34 +08:00
|
|
|
#include "lld/Core/Error.h"
|
|
|
|
#include "lld/ReaderWriter/MachOLinkingContext.h"
|
|
|
|
#include "llvm/ADT/SmallString.h"
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
2017-06-07 11:48:56 +08:00
|
|
|
#include "llvm/BinaryFormat/MachO.h"
|
2014-01-11 09:07:43 +08:00
|
|
|
#include "llvm/Support/Allocator.h"
|
2015-12-17 06:03:21 +08:00
|
|
|
#include "llvm/Support/Debug.h"
|
2013-10-08 08:43:34 +08:00
|
|
|
#include "llvm/Support/ErrorOr.h"
|
|
|
|
#include "llvm/Support/YAMLTraits.h"
|
|
|
|
|
2014-01-11 09:07:43 +08:00
|
|
|
using llvm::BumpPtrAllocator;
|
2013-10-08 08:43:34 +08:00
|
|
|
using llvm::yaml::Hex64;
|
|
|
|
using llvm::yaml::Hex32;
|
2014-07-25 07:06:56 +08:00
|
|
|
using llvm::yaml::Hex16;
|
2013-10-08 08:43:34 +08:00
|
|
|
using llvm::yaml::Hex8;
|
|
|
|
using llvm::yaml::SequenceTraits;
|
|
|
|
using llvm::MachO::HeaderFileType;
|
|
|
|
using llvm::MachO::BindType;
|
|
|
|
using llvm::MachO::RebaseType;
|
|
|
|
using llvm::MachO::NListType;
|
|
|
|
using llvm::MachO::RelocationInfoType;
|
|
|
|
using llvm::MachO::SectionType;
|
|
|
|
using llvm::MachO::LoadCommandType;
|
|
|
|
using llvm::MachO::ExportSymbolKind;
|
2014-07-25 07:06:56 +08:00
|
|
|
using llvm::MachO::DataRegionType;
|
2013-10-08 08:43:34 +08:00
|
|
|
|
|
|
|
namespace lld {
|
|
|
|
namespace mach_o {
|
|
|
|
namespace normalized {
|
|
|
|
|
|
|
|
|
|
|
|
/// The real mach-o relocation record is 8-bytes on disk and is
|
|
|
|
/// encoded in one of two different bit-field patterns. This
|
2013-10-08 10:07:19 +08:00
|
|
|
/// normalized form has the union of all possible fields.
|
2013-10-08 08:43:34 +08:00
|
|
|
struct Relocation {
|
2014-01-27 11:09:26 +08:00
|
|
|
Relocation() : offset(0), scattered(false),
|
|
|
|
type(llvm::MachO::GENERIC_RELOC_VANILLA),
|
|
|
|
length(0), pcRel(false), isExtern(false), value(0),
|
2013-10-08 08:43:34 +08:00
|
|
|
symbol(0) { }
|
|
|
|
|
|
|
|
Hex32 offset;
|
|
|
|
bool scattered;
|
|
|
|
RelocationInfoType type;
|
|
|
|
uint8_t length;
|
|
|
|
bool pcRel;
|
|
|
|
bool isExtern;
|
|
|
|
Hex32 value;
|
|
|
|
uint32_t symbol;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// A typedef so that YAML I/O can treat this vector as a sequence.
|
|
|
|
typedef std::vector<Relocation> Relocations;
|
|
|
|
|
|
|
|
/// A typedef so that YAML I/O can process the raw bytes in a section.
|
|
|
|
typedef std::vector<Hex8> ContentBytes;
|
|
|
|
|
|
|
|
/// A typedef so that YAML I/O can treat indirect symbols as a flow sequence.
|
|
|
|
typedef std::vector<uint32_t> IndirectSymbols;
|
|
|
|
|
|
|
|
/// A typedef so that YAML I/O can encode/decode section attributes.
|
2014-03-19 17:38:31 +08:00
|
|
|
LLVM_YAML_STRONG_TYPEDEF(uint32_t, SectionAttr)
|
2013-10-08 08:43:34 +08:00
|
|
|
|
2016-03-24 08:36:37 +08:00
|
|
|
/// A typedef so that YAML I/O can encode/decode section alignment.
|
|
|
|
LLVM_YAML_STRONG_TYPEDEF(uint16_t, SectionAlignment)
|
|
|
|
|
2013-10-08 08:43:34 +08:00
|
|
|
/// Mach-O has a 32-bit and 64-bit section record. This normalized form
|
|
|
|
/// can support either kind.
|
|
|
|
struct Section {
|
2014-01-27 11:09:26 +08:00
|
|
|
Section() : type(llvm::MachO::S_REGULAR),
|
2015-03-26 09:44:01 +08:00
|
|
|
attributes(0), alignment(1), address(0) { }
|
2013-10-08 08:43:34 +08:00
|
|
|
|
|
|
|
StringRef segmentName;
|
|
|
|
StringRef sectionName;
|
|
|
|
SectionType type;
|
|
|
|
SectionAttr attributes;
|
2016-03-24 08:36:37 +08:00
|
|
|
SectionAlignment alignment;
|
2013-10-08 08:43:34 +08:00
|
|
|
Hex64 address;
|
2014-01-11 09:07:43 +08:00
|
|
|
ArrayRef<uint8_t> content;
|
2013-10-08 08:43:34 +08:00
|
|
|
Relocations relocations;
|
|
|
|
IndirectSymbols indirectSymbols;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// A typedef so that YAML I/O can encode/decode the scope bits of an nlist.
|
2014-03-19 17:38:31 +08:00
|
|
|
LLVM_YAML_STRONG_TYPEDEF(uint8_t, SymbolScope)
|
2013-10-08 08:43:34 +08:00
|
|
|
|
|
|
|
/// A typedef so that YAML I/O can encode/decode the desc bits of an nlist.
|
2014-03-19 17:38:31 +08:00
|
|
|
LLVM_YAML_STRONG_TYPEDEF(uint16_t, SymbolDesc)
|
2013-10-08 08:43:34 +08:00
|
|
|
|
|
|
|
/// Mach-O has a 32-bit and 64-bit symbol table entry (nlist), and the symbol
|
|
|
|
/// type and scope and mixed in the same n_type field. This normalized form
|
2014-01-27 11:09:26 +08:00
|
|
|
/// works for any pointer size and separates out the type and scope.
|
2013-10-08 08:43:34 +08:00
|
|
|
struct Symbol {
|
|
|
|
Symbol() : type(llvm::MachO::N_UNDF), scope(0), sect(0), desc(0), value(0) { }
|
|
|
|
|
|
|
|
StringRef name;
|
|
|
|
NListType type;
|
|
|
|
SymbolScope scope;
|
|
|
|
uint8_t sect;
|
|
|
|
SymbolDesc desc;
|
|
|
|
Hex64 value;
|
|
|
|
};
|
|
|
|
|
2015-12-12 07:25:09 +08:00
|
|
|
/// Check whether the given section type indicates a zero-filled section.
|
|
|
|
// FIXME: Utility functions of this kind should probably be moved into
|
|
|
|
// llvm/Support.
|
|
|
|
inline bool isZeroFillSection(SectionType T) {
|
|
|
|
return (T == llvm::MachO::S_ZEROFILL ||
|
|
|
|
T == llvm::MachO::S_THREAD_LOCAL_ZEROFILL);
|
|
|
|
}
|
|
|
|
|
2013-10-08 08:43:34 +08:00
|
|
|
/// A typedef so that YAML I/O can (de/en)code the protection bits of a segment.
|
2014-03-19 17:38:31 +08:00
|
|
|
LLVM_YAML_STRONG_TYPEDEF(uint32_t, VMProtect)
|
2013-10-08 08:43:34 +08:00
|
|
|
|
2014-11-19 10:21:53 +08:00
|
|
|
/// A typedef to hold verions X.Y.X packed into 32-bit xxxx.yy.zz
|
|
|
|
LLVM_YAML_STRONG_TYPEDEF(uint32_t, PackedVersion)
|
|
|
|
|
2013-10-08 08:43:34 +08:00
|
|
|
/// Segments are only used in normalized final linked images (not in relocatable
|
|
|
|
/// object files). They specify how a range of the file is loaded.
|
|
|
|
struct Segment {
|
|
|
|
StringRef name;
|
|
|
|
Hex64 address;
|
|
|
|
Hex64 size;
|
2016-02-06 08:51:16 +08:00
|
|
|
VMProtect init_access;
|
|
|
|
VMProtect max_access;
|
2013-10-08 08:43:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Only used in normalized final linked images to specify on which dylibs
|
|
|
|
/// it depends.
|
|
|
|
struct DependentDylib {
|
|
|
|
StringRef path;
|
|
|
|
LoadCommandType kind;
|
2014-11-19 10:21:53 +08:00
|
|
|
PackedVersion compatVersion;
|
|
|
|
PackedVersion currentVersion;
|
2013-10-08 08:43:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/// A normalized rebasing entry. Only used in normalized final linked images.
|
|
|
|
struct RebaseLocation {
|
|
|
|
Hex32 segOffset;
|
|
|
|
uint8_t segIndex;
|
|
|
|
RebaseType kind;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// A normalized binding entry. Only used in normalized final linked images.
|
|
|
|
struct BindLocation {
|
|
|
|
Hex32 segOffset;
|
|
|
|
uint8_t segIndex;
|
|
|
|
BindType kind;
|
|
|
|
bool canBeNull;
|
|
|
|
int ordinal;
|
|
|
|
StringRef symbolName;
|
|
|
|
Hex64 addend;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// A typedef so that YAML I/O can encode/decode export flags.
|
2014-03-19 17:38:31 +08:00
|
|
|
LLVM_YAML_STRONG_TYPEDEF(uint32_t, ExportFlags)
|
2013-10-08 08:43:34 +08:00
|
|
|
|
|
|
|
/// A normalized export entry. Only used in normalized final linked images.
|
|
|
|
struct Export {
|
|
|
|
StringRef name;
|
|
|
|
Hex64 offset;
|
|
|
|
ExportSymbolKind kind;
|
|
|
|
ExportFlags flags;
|
|
|
|
Hex32 otherOffset;
|
|
|
|
StringRef otherName;
|
|
|
|
};
|
|
|
|
|
2014-07-25 07:06:56 +08:00
|
|
|
/// A normalized data-in-code entry.
|
|
|
|
struct DataInCode {
|
|
|
|
Hex32 offset;
|
|
|
|
Hex16 length;
|
|
|
|
DataRegionType kind;
|
|
|
|
};
|
|
|
|
|
2013-10-08 08:43:34 +08:00
|
|
|
/// A typedef so that YAML I/O can encode/decode mach_header.flags.
|
2014-03-19 17:38:31 +08:00
|
|
|
LLVM_YAML_STRONG_TYPEDEF(uint32_t, FileFlags)
|
2013-10-08 08:43:34 +08:00
|
|
|
|
2014-01-27 11:09:26 +08:00
|
|
|
///
|
2013-10-08 08:43:34 +08:00
|
|
|
struct NormalizedFile {
|
2015-06-24 03:55:04 +08:00
|
|
|
MachOLinkingContext::Arch arch = MachOLinkingContext::arch_unknown;
|
|
|
|
HeaderFileType fileType = llvm::MachO::MH_OBJECT;
|
|
|
|
FileFlags flags = 0;
|
2013-10-08 08:43:34 +08:00
|
|
|
std::vector<Segment> segments; // Not used in object files.
|
|
|
|
std::vector<Section> sections;
|
2014-01-27 11:09:26 +08:00
|
|
|
|
2013-10-08 08:43:34 +08:00
|
|
|
// Symbols sorted by kind.
|
|
|
|
std::vector<Symbol> localSymbols;
|
|
|
|
std::vector<Symbol> globalSymbols;
|
|
|
|
std::vector<Symbol> undefinedSymbols;
|
2016-07-28 06:55:30 +08:00
|
|
|
std::vector<Symbol> stabsSymbols;
|
2014-01-27 11:09:26 +08:00
|
|
|
|
2013-10-08 08:43:34 +08:00
|
|
|
// Maps to load commands with no LINKEDIT content (final linked images only).
|
|
|
|
std::vector<DependentDylib> dependentDylibs;
|
2015-06-24 03:55:04 +08:00
|
|
|
StringRef installName; // dylibs only
|
|
|
|
PackedVersion compatVersion = 0; // dylibs only
|
|
|
|
PackedVersion currentVersion = 0; // dylibs only
|
|
|
|
bool hasUUID = false;
|
2016-02-04 06:28:29 +08:00
|
|
|
bool hasMinVersionLoadCommand = false;
|
2016-02-09 10:10:39 +08:00
|
|
|
bool generateDataInCodeLoadCommand = false;
|
2013-10-08 08:43:34 +08:00
|
|
|
std::vector<StringRef> rpaths;
|
2015-06-24 03:55:04 +08:00
|
|
|
Hex64 entryAddress = 0;
|
|
|
|
Hex64 stackSize = 0;
|
|
|
|
MachOLinkingContext::OS os = MachOLinkingContext::OS::unknown;
|
|
|
|
Hex64 sourceVersion = 0;
|
|
|
|
PackedVersion minOSverson = 0;
|
|
|
|
PackedVersion sdkVersion = 0;
|
2016-02-04 10:16:08 +08:00
|
|
|
LoadCommandType minOSVersionKind = (LoadCommandType)0;
|
2014-01-27 11:09:26 +08:00
|
|
|
|
2013-10-08 08:43:34 +08:00
|
|
|
// Maps to load commands with LINKEDIT content (final linked images only).
|
2015-06-24 03:55:04 +08:00
|
|
|
Hex32 pageSize = 0;
|
2013-10-08 08:43:34 +08:00
|
|
|
std::vector<RebaseLocation> rebasingInfo;
|
|
|
|
std::vector<BindLocation> bindingInfo;
|
|
|
|
std::vector<BindLocation> weakBindingInfo;
|
|
|
|
std::vector<BindLocation> lazyBindingInfo;
|
|
|
|
std::vector<Export> exportInfo;
|
2016-02-09 09:38:13 +08:00
|
|
|
std::vector<uint8_t> functionStarts;
|
2014-07-25 07:06:56 +08:00
|
|
|
std::vector<DataInCode> dataInCode;
|
2014-01-27 11:09:26 +08:00
|
|
|
|
2013-10-08 08:43:34 +08:00
|
|
|
// TODO:
|
|
|
|
// code-signature
|
|
|
|
// split-seg-info
|
|
|
|
// function-starts
|
2014-01-27 11:09:26 +08:00
|
|
|
|
2014-01-11 09:07:43 +08:00
|
|
|
// For any allocations in this struct which need to be owned by this struct.
|
|
|
|
BumpPtrAllocator ownedAllocations;
|
2013-10-08 08:43:34 +08:00
|
|
|
};
|
|
|
|
|
2014-09-05 04:08:30 +08:00
|
|
|
/// Tests if a file is a non-fat mach-o object file.
|
|
|
|
bool isThinObjectFile(StringRef path, MachOLinkingContext::Arch &arch);
|
2013-10-08 08:43:34 +08:00
|
|
|
|
2014-10-08 09:48:10 +08:00
|
|
|
/// If the buffer is a fat file with the request arch, then this function
|
|
|
|
/// returns true with 'offset' and 'size' set to location of the arch slice
|
|
|
|
/// within the buffer. Otherwise returns false;
|
2015-04-28 06:48:51 +08:00
|
|
|
bool sliceFromFatFile(MemoryBufferRef mb, MachOLinkingContext::Arch arch,
|
|
|
|
uint32_t &offset, uint32_t &size);
|
2014-10-08 09:48:10 +08:00
|
|
|
|
2013-10-08 08:43:34 +08:00
|
|
|
/// Reads a mach-o file and produces an in-memory normalized view.
|
2016-03-31 07:58:24 +08:00
|
|
|
llvm::Expected<std::unique_ptr<NormalizedFile>>
|
2014-01-15 06:32:38 +08:00
|
|
|
readBinary(std::unique_ptr<MemoryBuffer> &mb,
|
|
|
|
const MachOLinkingContext::Arch arch);
|
2013-10-08 08:43:34 +08:00
|
|
|
|
|
|
|
/// Takes in-memory normalized view and writes a mach-o object file.
|
2016-03-31 07:10:39 +08:00
|
|
|
llvm::Error writeBinary(const NormalizedFile &file, StringRef path);
|
2013-10-08 08:43:34 +08:00
|
|
|
|
|
|
|
size_t headerAndLoadCommandsSize(const NormalizedFile &file);
|
|
|
|
|
|
|
|
|
|
|
|
/// Parses a yaml encoded mach-o file to produce an in-memory normalized view.
|
2016-03-31 09:13:04 +08:00
|
|
|
llvm::Expected<std::unique_ptr<NormalizedFile>>
|
2013-10-08 08:43:34 +08:00
|
|
|
readYaml(std::unique_ptr<MemoryBuffer> &mb);
|
|
|
|
|
|
|
|
/// Writes a yaml encoded mach-o files given an in-memory normalized view.
|
2014-06-12 22:53:47 +08:00
|
|
|
std::error_code writeYaml(const NormalizedFile &file, raw_ostream &out);
|
2013-10-08 08:43:34 +08:00
|
|
|
|
2016-03-31 07:43:27 +08:00
|
|
|
llvm::Error
|
Separate file parsing from File's constructors.
This is a second patch for InputGraph cleanup.
Sorry about the size of the patch, but what I did in this
patch is basically moving code from constructor to a new
method, parse(), so the amount of new code is small.
This has no change in functionality.
We've discussed the issue that we have too many classes
to represent a concept of "file". We have File subclasses
that represent files read from disk. In addition to that,
we have bunch of InputElement subclasses (that are part
of InputGraph) that represent command line arguments for
input file names. InputElement is a wrapper for File.
InputElement has parseFile method. The method instantiates
a File. The File's constructor reads a file from disk and
parses that.
Because parseFile method is called from multiple worker
threads, file parsing is processed in parallel. In other
words, one reason why we needed the wrapper classes is
because a File would start reading a file as soon as it
is instantiated.
So, the reason why we have too many classes here is at
least partly because of the design flaw of File class.
Just like threads in a good threading library, we need
to separate instantiation from "start" method, so that
we can instantiate File objects when we need them (which
should be very fast because it involves only one mmap()
and no real file IO) and use them directly instead of
the wrapper classes. Later, we call parse() on each
file in parallel to let them do actual file IO.
In this design, we can eliminate a reason to have the
wrapper classes.
In order to minimize the size of the patch, I didn't go so
far as to replace the wrapper classes with File classes.
The wrapper classes are still there.
In this patch, we call parse() immediately after
instantiating a File, so this really has no change in
functionality. Eventually the call of parse() should be
moved to Driver::link(). That'll be done in another patch.
llvm-svn: 224102
2014-12-12 15:31:09 +08:00
|
|
|
normalizedObjectToAtoms(MachOFile *file,
|
|
|
|
const NormalizedFile &normalizedFile,
|
|
|
|
bool copyRefs);
|
|
|
|
|
2016-03-31 07:43:27 +08:00
|
|
|
llvm::Error
|
Separate file parsing from File's constructors.
This is a second patch for InputGraph cleanup.
Sorry about the size of the patch, but what I did in this
patch is basically moving code from constructor to a new
method, parse(), so the amount of new code is small.
This has no change in functionality.
We've discussed the issue that we have too many classes
to represent a concept of "file". We have File subclasses
that represent files read from disk. In addition to that,
we have bunch of InputElement subclasses (that are part
of InputGraph) that represent command line arguments for
input file names. InputElement is a wrapper for File.
InputElement has parseFile method. The method instantiates
a File. The File's constructor reads a file from disk and
parses that.
Because parseFile method is called from multiple worker
threads, file parsing is processed in parallel. In other
words, one reason why we needed the wrapper classes is
because a File would start reading a file as soon as it
is instantiated.
So, the reason why we have too many classes here is at
least partly because of the design flaw of File class.
Just like threads in a good threading library, we need
to separate instantiation from "start" method, so that
we can instantiate File objects when we need them (which
should be very fast because it involves only one mmap()
and no real file IO) and use them directly instead of
the wrapper classes. Later, we call parse() on each
file in parallel to let them do actual file IO.
In this design, we can eliminate a reason to have the
wrapper classes.
In order to minimize the size of the patch, I didn't go so
far as to replace the wrapper classes with File classes.
The wrapper classes are still there.
In this patch, we call parse() immediately after
instantiating a File, so this really has no change in
functionality. Eventually the call of parse() should be
moved to Driver::link(). That'll be done in another patch.
llvm-svn: 224102
2014-12-12 15:31:09 +08:00
|
|
|
normalizedDylibToAtoms(MachODylibFile *file,
|
|
|
|
const NormalizedFile &normalizedFile,
|
|
|
|
bool copyRefs);
|
|
|
|
|
2013-10-08 08:43:34 +08:00
|
|
|
/// Takes in-memory normalized dylib or object and parses it into lld::File
|
2016-03-31 07:43:27 +08:00
|
|
|
llvm::Expected<std::unique_ptr<lld::File>>
|
2014-01-27 11:09:26 +08:00
|
|
|
normalizedToAtoms(const NormalizedFile &normalizedFile, StringRef path,
|
2014-01-11 09:07:43 +08:00
|
|
|
bool copyRefs);
|
2013-10-08 08:43:34 +08:00
|
|
|
|
|
|
|
/// Takes atoms and generates a normalized macho-o view.
|
2016-03-31 07:10:39 +08:00
|
|
|
llvm::Expected<std::unique_ptr<NormalizedFile>>
|
2013-10-08 08:43:34 +08:00
|
|
|
normalizedFromAtoms(const lld::File &atomFile, const MachOLinkingContext &ctxt);
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace normalized
|
2014-01-11 09:07:43 +08:00
|
|
|
|
|
|
|
/// Class for interfacing mach-o yaml files into generic yaml parsing
|
|
|
|
class MachOYamlIOTaggedDocumentHandler : public YamlIOTaggedDocumentHandler {
|
2014-07-01 06:57:33 +08:00
|
|
|
public:
|
|
|
|
MachOYamlIOTaggedDocumentHandler(MachOLinkingContext::Arch arch)
|
|
|
|
: _arch(arch) { }
|
2014-03-29 05:36:33 +08:00
|
|
|
bool handledDocTag(llvm::yaml::IO &io, const lld::File *&file) const override;
|
2014-07-01 06:57:33 +08:00
|
|
|
private:
|
|
|
|
const MachOLinkingContext::Arch _arch;
|
2014-01-11 09:07:43 +08:00
|
|
|
};
|
|
|
|
|
2013-10-08 08:43:34 +08:00
|
|
|
} // namespace mach_o
|
|
|
|
} // namespace lld
|
|
|
|
|
2013-11-15 11:09:26 +08:00
|
|
|
#endif // LLD_READER_WRITER_MACHO_NORMALIZE_FILE_H
|