Path: blob/main/contrib/llvm-project/llvm/lib/ObjCopy/MachO/MachOReader.h
35267 views
//===- MachOReader.h --------------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_LIB_OBJCOPY_MACHO_MACHOREADER_H9#define LLVM_LIB_OBJCOPY_MACHO_MACHOREADER_H1011#include "MachOObject.h"12#include "llvm/BinaryFormat/MachO.h"13#include "llvm/ObjCopy/MachO/MachOObjcopy.h"14#include "llvm/Object/MachO.h"15#include <memory>1617namespace llvm {18namespace objcopy {19namespace macho {2021// The hierarchy of readers is responsible for parsing different inputs:22// raw binaries and regular MachO object files.23class Reader {24public:25virtual ~Reader(){};26virtual Expected<std::unique_ptr<Object>> create() const = 0;27};2829class MachOReader : public Reader {30const object::MachOObjectFile &MachOObj;3132void readHeader(Object &O) const;33Error readLoadCommands(Object &O) const;34void readSymbolTable(Object &O) const;35void setSymbolInRelocationInfo(Object &O) const;36void readRebaseInfo(Object &O) const;37void readBindInfo(Object &O) const;38void readWeakBindInfo(Object &O) const;39void readLazyBindInfo(Object &O) const;40void readExportInfo(Object &O) const;41void readLinkData(Object &O, std::optional<size_t> LCIndex,42LinkData &LD) const;43void readCodeSignature(Object &O) const;44void readDataInCodeData(Object &O) const;45void readLinkerOptimizationHint(Object &O) const;46void readFunctionStartsData(Object &O) const;47void readDylibCodeSignDRs(Object &O) const;48void readExportsTrie(Object &O) const;49void readChainedFixups(Object &O) const;50void readIndirectSymbolTable(Object &O) const;51void readSwiftVersion(Object &O) const;5253public:54explicit MachOReader(const object::MachOObjectFile &Obj) : MachOObj(Obj) {}5556Expected<std::unique_ptr<Object>> create() const override;57};5859} // end namespace macho60} // end namespace objcopy61} // end namespace llvm6263#endif // LLVM_LIB_OBJCOPY_MACHO_MACHOREADER_H646566