MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / ApplyHeaderSections

Method ApplyHeaderSections

view/sharedcache/core/MachOProcessor.cpp:134–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134uint64_t SharedCacheMachOProcessor::ApplyHeaderSections(SharedCacheMachOHeader& header)
135{
136 auto initSection = [&](const section_64& section, const std::string& sectionName) {
137 if (!section.size)
138 return false;
139
140 std::string type;
141 BNSectionSemantics semantics = DefaultSectionSemantics;
142 switch (section.flags & 0xff)
143 {
144 case S_REGULAR:
145 if (section.flags & S_ATTR_PURE_INSTRUCTIONS)
146 {
147 type = "PURE_CODE";
148 semantics = ReadOnlyCodeSectionSemantics;
149 }
150 else if (section.flags & S_ATTR_SOME_INSTRUCTIONS)
151 {
152 type = "CODE";
153 semantics = ReadOnlyCodeSectionSemantics;
154 }
155 else
156 {
157 type = "REGULAR";
158 }
159 break;
160 case S_ZEROFILL:
161 type = "ZEROFILL";
162 semantics = ReadWriteDataSectionSemantics;
163 break;
164 case S_CSTRING_LITERALS:
165 type = "CSTRING_LITERALS";
166 semantics = ReadOnlyDataSectionSemantics;
167 break;
168 case S_4BYTE_LITERALS:
169 type = "4BYTE_LITERALS";
170 break;
171 case S_8BYTE_LITERALS:
172 type = "8BYTE_LITERALS";
173 break;
174 case S_LITERAL_POINTERS:
175 type = "LITERAL_POINTERS";
176 semantics = ReadOnlyDataSectionSemantics;
177 break;
178 case S_NON_LAZY_SYMBOL_POINTERS:
179 type = "NON_LAZY_SYMBOL_POINTERS";
180 semantics = ReadOnlyDataSectionSemantics;
181 break;
182 case S_LAZY_SYMBOL_POINTERS:
183 type = "LAZY_SYMBOL_POINTERS";
184 semantics = ReadOnlyDataSectionSemantics;
185 break;
186 case S_SYMBOL_STUBS:
187 type = "SYMBOL_STUBS";
188 semantics = ReadOnlyCodeSectionSemantics;
189 break;
190 case S_MOD_INIT_FUNC_POINTERS:
191 type = "MOD_INIT_FUNC_POINTERS";

Callers

nothing calls this directly

Calls 2

AddUserSectionMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected