Lines Matching refs:LC

33 using LoadCommandPred = std::function<bool(const LoadCommand &LC)>;
36 static bool isLoadCommandWithPayloadString(const LoadCommand &LC) { in isLoadCommandWithPayloadString() argument
39 return LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_RPATH || in isLoadCommandWithPayloadString()
40 LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_ID_DYLIB || in isLoadCommandWithPayloadString()
41 LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_LOAD_DYLIB || in isLoadCommandWithPayloadString()
42 LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_LOAD_WEAK_DYLIB; in isLoadCommandWithPayloadString()
46 static StringRef getPayloadString(const LoadCommand &LC) { in getPayloadString() argument
47 assert(isLoadCommandWithPayloadString(LC) && in getPayloadString()
50 return StringRef(reinterpret_cast<const char *>(LC.Payload.data()), in getPayloadString()
51 LC.Payload.size()) in getPayloadString()
126 static void updateLoadCommandPayloadString(LoadCommand &LC, StringRef S) { in updateLoadCommandPayloadString() argument
127 assert(isLoadCommandWithPayloadString(LC) && in updateLoadCommandPayloadString()
132 LC.MachOLoadCommand.load_command_data.cmdsize = NewCmdsize; in updateLoadCommandPayloadString()
133 LC.Payload.assign(NewCmdsize - sizeof(LCType), 0); in updateLoadCommandPayloadString()
134 std::copy(S.begin(), S.end(), LC.Payload.begin()); in updateLoadCommandPayloadString()
138 LoadCommand LC; in buildRPathLoadCommand() local
143 LC.MachOLoadCommand.rpath_command_data = RPathLC; in buildRPathLoadCommand()
144 LC.Payload.assign(RPathLC.cmdsize - sizeof(MachO::rpath_command), 0); in buildRPathLoadCommand()
145 std::copy(Path.begin(), Path.end(), LC.Payload.begin()); in buildRPathLoadCommand()
146 return LC; in buildRPathLoadCommand()
155 &MachOConfig](const LoadCommand &LC) { in processLoadCommands() argument
156 if (LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_RPATH) { in processLoadCommands()
162 StringRef RPath = getPayloadString(LC); in processLoadCommands()
186 for (LoadCommand &LC : Obj.LoadCommands) { in processLoadCommands()
187 if (LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_RPATH) in processLoadCommands()
188 RPaths.insert(getPayloadString(LC)); in processLoadCommands()
205 for (LoadCommand &LC : Obj.LoadCommands) { in processLoadCommands()
206 switch (LC.MachOLoadCommand.load_command_data.cmd) { in processLoadCommands()
210 LC, *MachOConfig.SharedLibId); in processLoadCommands()
214 StringRef RPath = getPayloadString(LC); in processLoadCommands()
217 updateLoadCommandPayloadString<MachO::rpath_command>(LC, NewRPath); in processLoadCommands()
225 StringRef InstallName = getPayloadString(LC); in processLoadCommands()
229 updateLoadCommandPayloadString<MachO::dylib_command>(LC, in processLoadCommands()
263 auto RemovePred = [&MachOConfig](const LoadCommand &LC) { in processLoadCommands() argument
264 if (LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_SEGMENT_64 || in processLoadCommands()
265 LC.MachOLoadCommand.load_command_data.cmd == MachO::LC_SEGMENT) { in processLoadCommands()
266 return LC.Sections.empty() && in processLoadCommands()
267 MachOConfig.EmptySegmentsToRemove.contains(*LC.getSegmentName()); in processLoadCommands()
280 for (LoadCommand &LC : Obj.LoadCommands) in dumpSectionToFile()
281 for (const std::unique_ptr<Section> &Sec : LC.Sections) { in dumpSectionToFile()
309 for (LoadCommand &LC : Obj.LoadCommands) { in addSection()
310 Optional<StringRef> SegName = LC.getSegmentName(); in addSection()
312 uint64_t Addr = *LC.getSegmentVMAddr(); in addSection()
313 for (const std::unique_ptr<Section> &S : LC.Sections) in addSection()
315 LC.Sections.push_back(std::make_unique<Section>(Sec)); in addSection()
316 LC.Sections.back()->Addr = Addr; in addSection()
334 llvm::find_if(O.LoadCommands, [SegName](const LoadCommand &LC) { in findSection() argument
335 return LC.getSegmentName() == SegName; in findSection()
413 for (LoadCommand &LC : Obj.LoadCommands) in handleArgs()
414 for (std::unique_ptr<Section> &Sec : LC.Sections) in handleArgs()