Lines Matching full:sections

109   // Clear OutputSection::ptLoad for sections contained in removed  in removeEmptyPTLoad()
192 // combines the typical ELF GOT with the small data sections. It commonly in addReservedSymbols()
270 // In addition, demote symbols defined in discarded sections, so that
305 // Now that we have a complete set of output sections. This function in run()
312 // If --compressed-debug-sections is specified, compress .debug_* sections. in run()
313 // Do it right now because it changes the size of output sections. in run()
322 // we know the size of the sections. in run()
394 // With --gc-sections, the field is already filled. in markUsedLocalSymbols()
426 // from live sections. in shouldKeepInSymtab()
430 // Exclude local symbols pointing to .ARM.exidx sections. in shouldKeepInSymtab()
432 // sections. After merging the .ARM.exidx sections, some of these symbols in shouldKeepInSymtab()
473 // - demote symbols defined relative to /DISCARD/ discarded input sections so
505 // Iterate over all input sections and add a STT_SECTION symbol if any input in addSectionSymbols()
511 for (InputSectionBase *s : isd->sections) { in addSectionSymbols()
516 // Unlike other synthetic sections, mergeable output sections contain in addSectionSymbols()
517 // data copied from input sections, and there may be a relocation in addSectionSymbols()
552 // Non-allocatable or non-writable sections don't need RELRO because in isRelroSection()
554 // RELRO is for sections that are essentially read-only but need to in isRelroSection()
608 // Sections with some special names are put into RELRO. This is a in isRelroSection()
656 // Allocatable sections go first to reduce the total PT_LOAD size and in getSectionRank()
661 // Sort sections based on their access permission in the following in getSectionRank()
664 // Read-only sections come first such that they go in the PT_LOAD covering the in getSectionRank()
667 // The layout for writable sections is PT_LOAD(PT_GNU_RELRO(.data.rel.ro in getSectionRank()
676 // Among PROGBITS sections, place .lrodata further from .text. in getSectionRank()
692 // Put .note sections at the beginning so that they are likely to be in getSectionRank()
697 // Make PROGBITS sections (e.g .rodata .eh_frame) closer to .text to in getSectionRank()
698 // alleviate relocation overflow pressure. Large special sections such as in getSectionRank()
709 // TLS sections directly before the other RELRO sections. in getSectionRank()
727 // Within TLS sections, or within other RelRo sections, or within non-RelRo in getSectionRank()
728 // sections, place non-NOBITS sections first. in getSectionRank()
732 // Some architectures have additional ordering restrictions for sections in getSectionRank()
735 // PPC64 has a number of special SHT_PROGBITS+SHF_ALLOC+SHF_WRITE sections in getSectionRank()
749 // All sections with SHF_MIPS_GPREL flag should be grouped together in getSectionRank()
750 // because data in these sections is addressable with a gp relative address. in getSectionRank()
848 // that does not contain large sections. in setReservedSymbolSections()
911 // When placing orphan sections, we want to place them after symbol assignments
917 // We don't want to go over sections since findOrphanPos is the
918 // one in charge of deciding the order of the sections.
931 // We want to place orphan sections so that they share as much
937 // Place non-alloc orphan sections at the end. This matches how we assign file in findOrphanPos()
938 // offsets to non-alloc sections. in findOrphanPos()
1006 // alloc sections for example). in findOrphanPos()
1015 // Adds random priorities to sections not already in the map.
1020 SmallVector<InputSectionBase *, 0> matched, sections = ctx.inputSections; in maybeShuffle() local
1021 matched.reserve(sections.size()); in maybeShuffle()
1024 for (InputSectionBase *sec : sections) in maybeShuffle()
1029 // If --shuffle-sections <section-glob>=-1, reverse the section order. The in maybeShuffle()
1030 // section order is stable even if the number of sections changes. This is in maybeShuffle()
1039 for (InputSectionBase *&sec : sections) in maybeShuffle()
1045 // sections. in maybeShuffle()
1047 for (InputSectionBase *sec : sections) { in maybeShuffle()
1056 // Use the rarely used option --call-graph-ordering-file to sort sections. in buildSectionOrder()
1076 // Build a map from sections to their priorities. in buildSectionOrder()
1111 // Sorts the sections in ISD according to the provided section order.
1121 for (InputSection *isec : isd->sections) { in sortISDBySectionOrder()
1162 // The above is not necessary if total size of input sections in this "isd" in sortISDBySectionOrder()
1163 // is small. Note that we assume all input sections are executable if the in sortISDBySectionOrder()
1178 isd->sections.clear(); in sortISDBySectionOrder()
1180 isd->sections.push_back(isec); in sortISDBySectionOrder()
1182 isd->sections.push_back(p.first); in sortISDBySectionOrder()
1184 isd->sections.push_back(isec); in sortISDBySectionOrder()
1195 // Sort input sections by priority using the list provided by in sortSection()
1196 // --symbol-ordering-file or --shuffle-sections=. This is a least significant in sortSection()
1197 // digit radix sort. The sections may be sorted stably again by a more in sortSection()
1216 // that sections having smaller relocation offsets are at beginning of .toc in sortSection()
1219 llvm::stable_sort(isd->sections, in sortSection()
1228 // sorting for special input sections. This also handles --symbol-ordering-file.
1239 llvm::TimeTraceScope timeScope("Sort sections"); in sortSections()
1242 // relative order for SHF_LINK_ORDER sections. in sortSections()
1274 // Orphan sections are sections present in the input files which are in sortOrphanSections()
1277 // The sections in the linker script are already in the correct in sortOrphanSections()
1279 // sections. in sortOrphanSections()
1281 // The order of the sections in the script is arbitrary and may not agree with in sortOrphanSections()
1287 // have sections a, b and c with only b in a script and a less than c in sortOrphanSections()
1290 // to match, we can end up with sections a, b, c, d where b and c are in the in sortOrphanSections()
1299 // * Sort only the orphan sections. They are in the end right now. in sortOrphanSections()
1321 // Sort the orphan sections. in sortOrphanSections()
1339 // As an optimization, find all sections with the same sort rank in sortOrphanSections()
1353 // SHF_LINK_ORDER sections with non-zero sh_link are ordered before in compareByFilePosition()
1354 // non-SHF_LINK_ORDER sections and SHF_LINK_ORDER sections with zero sh_link. in compareByFilePosition()
1382 SmallVector<InputSection *, 0> sections; in resolveShfLinkOrder() local
1389 sections.clear(); in resolveShfLinkOrder()
1390 for (InputSection *&isec : isd->sections) { in resolveShfLinkOrder()
1399 sections.push_back(isec); in resolveShfLinkOrder()
1402 llvm::stable_sort(sections, compareByFilePosition); in resolveShfLinkOrder()
1403 for (int i = 0, n = sections.size(); i != n; ++i) in resolveShfLinkOrder()
1404 *scriptSections[i] = sections[i]; in resolveShfLinkOrder()
1412 llvm::TimeTraceScope timeScope("Finalize synthetic sections", sec->name); in finalizeSynthetic()
1553 // If Input Sections have been shrunk (basic block sections) then
1554 // update symbol values and sizes associated with these sections. With basic
1555 // block sections, input sections can shrink when the jump instructions at
1596 // If basic block sections exist, there are opportunities to delete fall thru
1605 // For every output section that has executable input sections, this in optimizeBasicBlockJumps()
1607 // 1. Deletes all direct jump instructions in input sections that in optimizeBasicBlockJumps()
1614 ArrayRef<InputSection *> sections = getInputSections(*osec, storage); in optimizeBasicBlockJumps() local
1619 for (size_t i = 0, e = sections.size(); i != e; ++i) { in optimizeBasicBlockJumps()
1620 InputSection *next = i + 1 < sections.size() ? sections[i + 1] : nullptr; in optimizeBasicBlockJumps()
1621 InputSection &sec = *sections[i]; in optimizeBasicBlockJumps()
1638 // In order to allow users to manipulate linker-synthesized sections,
1639 // we had to add synthetic sections to the input section list early,
1648 // scanRelocations is called to remove synthetic sections that turn
1651 // All input synthetic sections that can be empty are placed after in removeUnusedSyntheticSections()
1659 // Remove unused synthetic sections from ctx.inputSections; in removeUnusedSyntheticSections()
1679 // Remove unused synthetic sections from the corresponding input section in removeUnusedSyntheticSections()
1685 llvm::erase_if(isd->sections, [&](InputSection *isec) { in removeUnusedSyntheticSections()
1701 // symbols for sections, so that the runtime can get the start and end in finalizeSections()
1931 // Add separate segments for MIPS-specific sections. in finalizeSections()
1952 // have the headers, we can find out which sections they point to. in finalizeSections()
1961 llvm::TimeTraceScope timeScope("Finalize synthetic sections"); in finalizeSections()
2016 // sections to extend the ranges if jump targets are out of range. Such in finalizeSections()
2020 // because this is the earliest point where we know sizes of sections and in finalizeSections()
2024 // 2) Update the sections. We need to generate content that depends on the in finalizeSections()
2026 // android packed relocations sections content. in finalizeSections()
2038 llvm::TimeTraceScope timeScope("Finalize synthetic sections"); in finalizeSections()
2048 // sections. Run after in.symTab is finalized as optimizeBasicBlockJumps in finalizeSections()
2055 // of finalizing other sections. in finalizeSections()
2067 // Ensure data sections are not mixed with executable sections when
2085 // symbols for a few sections. This function defines them.
2137 // Don't allocate VA space for TLS NOBITS sections. The PT_TLS PHDR is in needsPtLoad()
2154 // Decide which program headers to create and which sections to include in each
2167 // Add the first PT_LOAD segment for regular output sections. in createPhdrs()
2186 // In the other partitions the headers are ordinary sections, so they don't in createPhdrs()
2195 // PT_GNU_RELRO includes all sections that should be marked as in createPhdrs()
2211 " sections"); in createPhdrs()
2223 // Normally, sections in partitions other than the current partition are in createPhdrs()
2244 // In addition, NOBITS sections should only be placed at the end of a LOAD in createPhdrs()
2252 // When --no-rosegment is specified, RO and RX sections are compatible. in createPhdrs()
2334 // Create one PT_NOTE per a group of contiguous SHT_NOTE sections with the in createPhdrs()
2386 // sections will be extracted to a separate file. Align to the next in fixSectionAlignments()
2443 // File offsets are not significant for .bss sections other than the first one in computeFileOffset()
2454 // If two sections share the same PT_LOAD the file offset is calculated in computeFileOffset()
2461 // Compute the minimum LMA of all non-empty non-NOBITS sections as minAddr. in assignFileOffsetsBinary()
2472 // Sections are laid out at LMA minus minAddr. in assignFileOffsetsBinary()
2485 // Assign file offsets to output sections.
2496 // Layout SHF_ALLOC sections before non-SHF_ALLOC sections. A non-SHF_ALLOC in assignFileOffsets()
2523 // Our logic assumes that sections have rising VA within the same segment. in assignFileOffsets()
2543 // file offsets and VAs to all sections.
2549 // .ARM.exidx sections may not be within a single .ARM.exidx in setPhdrs()
2594 // Check whether sections overlap for a specific address range (file offsets,
2596 static void checkOverlap(StringRef name, std::vector<SectionOffset> &sections, in checkOverlap() argument
2598 llvm::sort(sections, [=](const SectionOffset &a, const SectionOffset &b) { in checkOverlap()
2604 for (size_t i = 1, end = sections.size(); i < end; ++i) { in checkOverlap()
2605 SectionOffset a = sections[i - 1]; in checkOverlap()
2606 SectionOffset b = sections[i]; in checkOverlap()
2610 // If both sections are in OVERLAY we allow the overlapping of virtual in checkOverlap()
2623 // Check for overlapping sections and address overflows.
2625 // In this function we check that none of the output sections have overlapping
2626 // file offsets. For SHF_ALLOC sections we also check that the load address
2638 // section marked as SHT_NOBITS. These sections don't actually occupy space in in checkSections()
2640 // binary is specified only add SHF_ALLOC sections are added to the output in checkSections()
2641 // file so we skip any non-allocated sections in that case. in checkSections()
2656 // into account SHF_ALLOC sections since others will not be loaded. in checkSections()
2657 // Furthermore, we also need to skip SHF_TLS sections since these will be in checkSections()
2724 // e_shnum = 0, SHdrs[0].sh_size = number of sections. in writeHeader()
2794 // overwritten by output sections.
2822 llvm::TimeTraceScope timeScope("Write sections"); in writeSections()
2825 // In -r or --emit-relocs mode, write the relocation sections first as in in writeSections()
2879 // Compute a hash of all sections of the output file. in writeBuildId()