Lines Matching refs:Sec

54 using SectionPred = std::function<bool(const SectionBase &Sec)>;
56 static bool isDebugSection(const SectionBase &Sec) { in isDebugSection() argument
57 return StringRef(Sec.Name).startswith(".debug") || in isDebugSection()
58 StringRef(Sec.Name).startswith(".zdebug") || Sec.Name == ".gdb_index"; in isDebugSection()
61 static bool isDWOSection(const SectionBase &Sec) { in isDWOSection() argument
62 return StringRef(Sec.Name).endswith(".dwo"); in isDWOSection()
65 static bool onlyKeepDWOPred(const Object &Obj, const SectionBase &Sec) { in onlyKeepDWOPred() argument
67 if (&Sec == Obj.SectionNames) in onlyKeepDWOPred()
71 return !isDWOSection(Sec); in onlyKeepDWOPred()
175 [&](const SectionBase &Sec) { return onlyKeepDWOPred(*DWOFile, Sec); }); in splitDWOToFile() argument
186 for (auto &Sec : Obj.sections()) { in dumpSectionToFile() local
187 if (Sec.Name == SecName) { in dumpSectionToFile()
188 if (Sec.OriginalData.empty()) in dumpSectionToFile()
193 FileOutputBuffer::create(Filename, Sec.OriginalData.size()); in dumpSectionToFile()
197 std::copy(Sec.OriginalData.begin(), Sec.OriginalData.end(), in dumpSectionToFile()
228 for (auto &Sec : Obj.sections()) { in replaceDebugSections() local
229 if (RelocationSection *R = dyn_cast<RelocationSection>(&Sec)) { in replaceDebugSections()
235 if (shouldReplace(Sec)) in replaceDebugSections()
236 ToReplace.push_back(&Sec); in replaceDebugSections()
248 RemovePred = [shouldReplace, RemovePred](const SectionBase &Sec) { in replaceDebugSections() argument
249 return shouldReplace(Sec) || RemovePred(Sec); in replaceDebugSections()
351 RemovePred = [&Config](const SectionBase &Sec) { in handleArgs() argument
352 return is_contained(Config.ToRemove, Sec.Name); in handleArgs()
357 RemovePred = [RemovePred](const SectionBase &Sec) { in handleArgs() argument
358 return isDWOSection(Sec) || RemovePred(Sec); in handleArgs()
362 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in handleArgs() argument
363 return onlyKeepDWOPred(Obj, Sec) || RemovePred(Sec); in handleArgs()
367 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in handleArgs() argument
368 if (RemovePred(Sec)) in handleArgs()
370 if ((Sec.Flags & SHF_ALLOC) != 0) in handleArgs()
372 if (&Sec == Obj.SectionNames) in handleArgs()
374 switch (Sec.Type) { in handleArgs()
381 return isDebugSection(Sec); in handleArgs()
385 RemovePred = [RemovePred](const SectionBase &Sec) { in handleArgs() argument
386 return RemovePred(Sec) || (Sec.Flags & SHF_ALLOC) == 0; in handleArgs()
391 RemovePred = [RemovePred](const SectionBase &Sec) { in handleArgs() argument
392 return RemovePred(Sec) || isDebugSection(Sec); in handleArgs()
397 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in handleArgs() argument
398 if (RemovePred(Sec)) in handleArgs()
400 if (&Sec == Obj.SectionNames) in handleArgs()
402 return (Sec.Flags & SHF_ALLOC) == 0; in handleArgs()
406 RemovePred = [RemovePred, &Obj](const SectionBase &Sec) { in handleArgs() argument
407 if (RemovePred(Sec)) in handleArgs()
409 if (&Sec == Obj.SectionNames) in handleArgs()
411 if (StringRef(Sec.Name).startswith(".gnu.warning")) in handleArgs()
413 return (Sec.Flags & SHF_ALLOC) == 0; in handleArgs()
418 RemovePred = [&Config, RemovePred, &Obj](const SectionBase &Sec) { in handleArgs() argument
420 if (is_contained(Config.OnlySection, Sec.Name)) in handleArgs()
424 if (RemovePred(Sec)) in handleArgs()
428 if (Obj.SectionNames == &Sec) in handleArgs()
430 if (Obj.SymbolTable == &Sec || in handleArgs()
431 (Obj.SymbolTable && Obj.SymbolTable->getStrTab() == &Sec)) in handleArgs()
440 RemovePred = [&Config, RemovePred](const SectionBase &Sec) { in handleArgs() argument
442 if (is_contained(Config.KeepSection, Sec.Name)) in handleArgs()
445 return RemovePred(Sec); in handleArgs()
456 RemovePred = [&Obj, RemovePred](const SectionBase &Sec) { in handleArgs() argument
457 if (&Sec == Obj.SymbolTable || &Sec == Obj.SymbolTable->getStrTab()) in handleArgs()
459 return RemovePred(Sec); in handleArgs()
481 for (auto &Sec : Obj.sections()) { in handleArgs() local
482 const auto Iter = Config.SectionsToRename.find(Sec.Name); in handleArgs()
485 Sec.Name = SR.NewName; in handleArgs()
493 Sec.Flags = (Sec.Flags & PreserveMask) | in handleArgs()