Lines Matching defs:sections

10 // identify and merge two or more read-only sections (typically functions)
14 // In ICF, two sections are considered identical if they have the same
17 // relocation types, values, and if they point to the same sections *in
31 // What we are doing in LLD is to partition sections into equivalence
35 // 1. First, we partition sections using their hash values as keys. Hash
38 // account. We just put sections that apparently differ into different
41 // 2. Next, for each equivalence class, we visit sections to compare
53 // merge all the other sections in C with it.
123 std::vector<InputSection *> sections;
139 // other equivalence classes in parallel. They may read sections that we
141 // it breaks the invariance that all possibly-identical sections must be
165 // Don't merge writable sections. .data.rel.ro sections are marked as writable
171 // SHF_LINK_ORDER sections are ICF'd as a unit with their dependent sections,
176 // Don't merge synthetic sections as their Data member is not valid and empty.
187 // A user program may enumerate sections named with a C identifier using
188 // __start_* and __stop_* symbols. We cannot ICF any such sections because
199 // This loop rearranges sections in [Begin, End) so that all sections
204 // issue in practice because the number of the distinct sections in
211 std::stable_partition(sections.begin() + begin + 1,
212 sections.begin() + end, [&](InputSection *s) {
214 return equalsConstant(sections[begin], s);
215 return equalsVariable(sections[begin], s);
217 size_t mid = bound - sections.begin();
220 // updating the sections in [Begin, Mid). We use Mid as an equivalence
223 sections[i]->eqClass[next] = mid;
263 // and either symbol is preemptible, the containing sections should be
264 // considered different. This is because even if the sections are identical
315 // If two sections have different output sections, we cannot merge them.
335 // The two sections must be identical.
354 // Ineligible sections are in the special equivalence class 0.
375 uint32_t eqClass = sections[begin]->eqClass[current];
377 if (eqClass != sections[i]->eqClass[current])
384 // groups of sections, grouped by the class.
400 // If threading is disabled or the number of sections are
402 if (!threadsEnabled || sections.size() < 1024) {
403 forEachClassRange(0, sections.size(), fn);
416 size_t step = sections.size() / numShards;
419 boundaries[numShards] = sections.size();
422 boundaries[i] = findBoundary((i - 1) * step, sections.size());
432 // Combine the hashes of the sections referenced by the given section into its
461 // Collect sections to merge.
465 sections.push_back(s);
468 // Initially, we use hash values to partition sections.
469 parallelForEach(sections, [&](InputSection *s) {
474 parallelForEach(sections, [&](InputSection *s) {
482 // From now on, sections in Sections vector are ordered so that sections
484 llvm::stable_sort(sections, [](const InputSection *a, const InputSection *b) {
500 // Merge sections by the equivalence class.
501 forEachClassRange(0, sections.size(), [&](size_t begin, size_t end) {
504 print("selected section " + toString(sections[begin]));
506 print(" removing identical section " + toString(sections[i]));
507 sections[begin]->replace(sections[i]);
509 // At this point we know sections merged are fully identical and hence
511 // and relocation sections.
512 for (InputSection *isec : sections[i]->dependentSections)
517 // InputSectionDescription::sections is populated by processSectionCommands().
518 // ICF may fold some input sections assigned to output sections. Remove them.
523 llvm::erase_if(isd->sections,