Lines Matching refs:sec
46 void relocateAlloc(InputSectionBase &sec, uint8_t *buf) const override;
593 void RISCV::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const { in relocateAlloc() argument
594 uint64_t secAddr = sec.getOutputSection()->addr; in relocateAlloc()
595 if (auto *s = dyn_cast<InputSection>(&sec)) in relocateAlloc()
597 else if (auto *ehIn = dyn_cast<EhInputSection>(&sec)) in relocateAlloc()
601 const ArrayRef<Relocation> relocs = sec.relocs(); in relocateAlloc()
606 sec.getRelocTargetVA(sec.file, rel.type, rel.addend, in relocateAlloc()
664 errorOrWarn(sec.getLocation(rel.offset) + ": ULEB128 value " + in relocateAlloc()
671 errorOrWarn(sec.getLocation(rel.offset) + in relocateAlloc()
686 for (InputSection *sec : getInputSections(*osec, storage)) { in initSymbolAnchors()
687 sec->relaxAux = make<RelaxAux>(); in initSymbolAnchors()
688 if (sec->relocs().size()) { in initSymbolAnchors()
689 sec->relaxAux->relocDeltas = in initSymbolAnchors()
690 std::make_unique<uint32_t[]>(sec->relocs().size()); in initSymbolAnchors()
691 sec->relaxAux->relocTypes = in initSymbolAnchors()
692 std::make_unique<RelType[]>(sec->relocs().size()); in initSymbolAnchors()
711 if (auto *sec = dyn_cast_or_null<InputSection>(d->section)) in initSymbolAnchors() local
712 if (sec->flags & SHF_EXECINSTR && sec->relaxAux) { in initSymbolAnchors()
714 sec->relaxAux->anchors.push_back({d->value, d, false}); in initSymbolAnchors()
715 sec->relaxAux->anchors.push_back({d->value + d->size, d, true}); in initSymbolAnchors()
725 for (InputSection *sec : getInputSections(*osec, storage)) { in initSymbolAnchors()
726 llvm::sort(sec->relaxAux->anchors, [](auto &a, auto &b) { in initSymbolAnchors()
735 static void relaxCall(const InputSection &sec, size_t i, uint64_t loc, in relaxCall() argument
737 const bool rvc = getEFlags(sec.file) & EF_RISCV_RVC; in relaxCall()
739 const uint64_t insnPair = read64le(sec.content().data() + r.offset); in relaxCall()
746 sec.relaxAux->relocTypes[i] = R_RISCV_RVC_JUMP; in relaxCall()
747 sec.relaxAux->writes.push_back(0xa001); // c.j in relaxCall()
751 sec.relaxAux->relocTypes[i] = R_RISCV_RVC_JUMP; in relaxCall()
752 sec.relaxAux->writes.push_back(0x2001); // c.jal in relaxCall()
755 sec.relaxAux->relocTypes[i] = R_RISCV_JAL; in relaxCall()
756 sec.relaxAux->writes.push_back(0x6f | rd << 7); // jal in relaxCall()
762 static void relaxTlsLe(const InputSection &sec, size_t i, uint64_t loc, in relaxTlsLe() argument
767 uint32_t insn = read32le(sec.content().data() + r.offset); in relaxTlsLe()
772 sec.relaxAux->relocTypes[i] = R_RISCV_RELAX; in relaxTlsLe()
777 sec.relaxAux->relocTypes[i] = R_RISCV_32; in relaxTlsLe()
779 sec.relaxAux->writes.push_back(setLO12_I(insn, val)); in relaxTlsLe()
783 sec.relaxAux->relocTypes[i] = R_RISCV_32; in relaxTlsLe()
785 sec.relaxAux->writes.push_back(setLO12_S(insn, val)); in relaxTlsLe()
790 static void relaxHi20Lo12(const InputSection &sec, size_t i, uint64_t loc, in relaxHi20Lo12() argument
802 sec.relaxAux->relocTypes[i] = R_RISCV_RELAX; in relaxHi20Lo12()
806 sec.relaxAux->relocTypes[i] = INTERNAL_R_RISCV_GPREL_I; in relaxHi20Lo12()
809 sec.relaxAux->relocTypes[i] = INTERNAL_R_RISCV_GPREL_S; in relaxHi20Lo12()
814 static bool relax(InputSection &sec) { in relax() argument
815 const uint64_t secAddr = sec.getVA(); in relax()
816 const MutableArrayRef<Relocation> relocs = sec.relocs(); in relax()
817 auto &aux = *sec.relaxAux; in relax()
847 relaxCall(sec, i, loc, r, remove); in relax()
854 relaxTlsLe(sec, i, loc, r, remove); in relax()
860 relaxHi20Lo12(sec, i, loc, r, remove); in relax()
904 sec.bytesDropped = delta; in relax()
928 for (InputSection *sec : getInputSections(*osec, storage)) in relaxOnce()
929 changed |= relax(*sec); in relaxOnce()
941 for (InputSection *sec : getInputSections(*osec, storage)) { in finalizeRelax()
942 RelaxAux &aux = *sec->relaxAux; in finalizeRelax()
946 MutableArrayRef<Relocation> rels = sec->relocs(); in finalizeRelax()
947 ArrayRef<uint8_t> old = sec->content(); in finalizeRelax()
953 sec->content_ = p; in finalizeRelax()
954 sec->size = newSize; in finalizeRelax()
955 sec->bytesDropped = 0; in finalizeRelax()
1061 unsigned &mergedXlen, const InputSectionBase *sec, in mergeArch() argument
1065 errorOrWarn(toString(sec) + ": " + s + ": " + in mergeArch()
1186 for (const InputSectionBase *sec : sections) { in mergeAttributesSection() local
1188 if (Error e = parser.parse(sec->content(), llvm::endianness::little)) in mergeAttributesSection()
1189 warn(toString(sec) + ": " + llvm::toString(std::move(e))); in mergeAttributesSection()
1197 firstStackAlign = sec; in mergeAttributesSection()
1200 errorOrWarn(toString(sec) + " has stack_align=" + Twine(*i) + in mergeAttributesSection()
1215 mergeArch(exts, xlen, sec, *s); in mergeAttributesSection()
1229 firstAtomicAbi = sec; in mergeAttributesSection()
1231 mergeAtomic(r.first, firstAtomicAbi, sec, in mergeAttributesSection()