LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
FunctionVariantFixups.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2025 R. Thomas
2 * Copyright 2017 - 2025 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_MACHO_FUNCTION_VARIANT_FIXUPS_COMMAND_H
17#define LIEF_MACHO_FUNCTION_VARIANT_FIXUPS_COMMAND_H
18#include <ostream>
19
20#include "LIEF/visibility.h"
21
23
24namespace LIEF {
25namespace MachO {
26class BinaryParser;
27class LinkEdit;
28
29namespace details {
30struct linkedit_data_command;
31}
32
35 friend class BinaryParser;
36 friend class LinkEdit;
37
38 public:
40 FunctionVariantFixups(const details::linkedit_data_command& cmd);
41
44
45 std::unique_ptr<LoadCommand> clone() const override {
46 return std::unique_ptr<FunctionVariantFixups>(new FunctionVariantFixups(*this));
47 }
48
50 uint32_t data_offset() const {
51 return data_offset_;
52 }
53
55 uint32_t data_size() const {
56 return data_size_;
57 }
58
59 void data_offset(uint32_t offset) {
60 data_offset_ = offset;
61 }
62
63 void data_size(uint32_t size) {
64 data_size_ = size;
65 }
66
68 return content_;
69 }
70
72 return content_;
73 }
74
75
76 ~FunctionVariantFixups() override = default;
77
78 std::ostream& print(std::ostream& os) const override;
79
80 static bool classof(const LoadCommand* cmd) {
82 }
83
84 private:
85 uint32_t data_offset_ = 0;
86 uint32_t data_size_ = 0;
87 span<uint8_t> content_;
88};
89
90}
91}
92#endif
Class used to parse a single binary (i.e. non-FAT).
Definition BinaryParser.hpp:78
static bool classof(const LoadCommand *cmd)
Definition FunctionVariantFixups.hpp:80
void data_offset(uint32_t offset)
Definition FunctionVariantFixups.hpp:59
friend class BinaryParser
Definition FunctionVariantFixups.hpp:35
FunctionVariantFixups(const FunctionVariantFixups &copy)=default
uint32_t data_size() const
Size of the payload.
Definition FunctionVariantFixups.hpp:55
void data_size(uint32_t size)
Definition FunctionVariantFixups.hpp:63
FunctionVariantFixups(const details::linkedit_data_command &cmd)
uint32_t data_offset() const
Offset in the __LINKEDIT SegmentCommand where the payload starts.
Definition FunctionVariantFixups.hpp:50
std::ostream & print(std::ostream &os) const override
friend class LinkEdit
Definition FunctionVariantFixups.hpp:36
FunctionVariantFixups & operator=(const FunctionVariantFixups &copy)=default
~FunctionVariantFixups() override=default
span< uint8_t > content()
Definition FunctionVariantFixups.hpp:71
span< const uint8_t > content() const
Definition FunctionVariantFixups.hpp:67
std::unique_ptr< LoadCommand > clone() const override
Definition FunctionVariantFixups.hpp:45
Definition LinkEdit.hpp:45
uint32_t size() const
Size of the command (should be greather than sizeof(load_command)).
Definition LoadCommand.hpp:133
LoadCommand::TYPE command() const
Command type.
Definition LoadCommand.hpp:128
@ FUNCTION_VARIANT_FIXUPS
Definition LoadCommand.hpp:102
Definition endianness_support.hpp:59
Namespace related to the LIEF's Mach-O module.
Definition Abstract/Header.hpp:36
LIEF namespace.
Definition Abstract/Binary.hpp:40
tcb::span< ElementType, Extent > span
Definition span.hpp:22
#define LIEF_API
Definition visibility.h:41