LLVM 20.0.0git
MachOReader.h
Go to the documentation of this file.
1//===- MachOReader.h --------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIB_OBJCOPY_MACHO_MACHOREADER_H
10#define LLVM_LIB_OBJCOPY_MACHO_MACHOREADER_H
11
12#include "MachOObject.h"
15#include "llvm/Object/MachO.h"
16#include <memory>
17
18namespace llvm {
19namespace objcopy {
20namespace macho {
21
22// The hierarchy of readers is responsible for parsing different inputs:
23// raw binaries and regular MachO object files.
24class Reader {
25public:
26 virtual ~Reader(){};
28};
29
30class MachOReader : public Reader {
31 const object::MachOObjectFile &MachOObj;
32
33 void readHeader(Object &O) const;
34 Error readLoadCommands(Object &O) const;
35 void readSymbolTable(Object &O) const;
36 void setSymbolInRelocationInfo(Object &O) const;
37 void readRebaseInfo(Object &O) const;
38 void readBindInfo(Object &O) const;
39 void readWeakBindInfo(Object &O) const;
40 void readLazyBindInfo(Object &O) const;
41 void readExportInfo(Object &O) const;
42 void readLinkData(Object &O, std::optional<size_t> LCIndex,
43 LinkData &LD) const;
44 void readCodeSignature(Object &O) const;
45 void readDataInCodeData(Object &O) const;
46 void readLinkerOptimizationHint(Object &O) const;
47 void readFunctionStartsData(Object &O) const;
48 void readDylibCodeSignDRs(Object &O) const;
49 void readExportsTrie(Object &O) const;
50 void readChainedFixups(Object &O) const;
51 void readIndirectSymbolTable(Object &O) const;
52 void readSwiftVersion(Object &O) const;
53
54public:
55 explicit MachOReader(const object::MachOObjectFile &Obj) : MachOObj(Obj) {}
56
58};
59
60} // end namespace macho
61} // end namespace objcopy
62} // end namespace llvm
63
64#endif // LLVM_LIB_OBJCOPY_MACHO_MACHOREADER_H
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
Tagged union holding either a T or a Error.
Definition: Error.h:481
Expected< std::unique_ptr< Object > > create() const override
MachOReader(const object::MachOObjectFile &Obj)
Definition: MachOReader.h:55
virtual Expected< std::unique_ptr< Object > > create() const =0
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18