Lines Matching defs:sec

46   void relocateAlloc(InputSectionBase &sec, uint8_t *buf) const override;
577 void RISCV::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const {
578 uint64_t secAddr = sec.getOutputSection()->addr;
579 if (auto *s = dyn_cast<InputSection>(&sec))
581 else if (auto *ehIn = dyn_cast<EhInputSection>(&sec))
585 const ArrayRef<Relocation> relocs = sec.relocs();
589 uint64_t val = sec.getRelocTargetVA(ctx, rel, secAddr + rel.offset);
647 Err(ctx) << sec.getLocation(rel.offset) << ": ULEB128 value " << val
654 Err(ctx) << sec.getLocation(rel.offset)
669 for (InputSection *sec : getInputSections(*osec, storage)) {
670 sec->relaxAux = make<RelaxAux>();
671 if (sec->relocs().size()) {
672 sec->relaxAux->relocDeltas =
673 std::make_unique<uint32_t[]>(sec->relocs().size());
674 sec->relaxAux->relocTypes =
675 std::make_unique<RelType[]>(sec->relocs().size());
694 if (auto *sec = dyn_cast_or_null<InputSection>(d->section))
695 if (sec->flags & SHF_EXECINSTR && sec->relaxAux) {
696 // If sec is discarded, relaxAux will be nullptr.
697 sec->relaxAux->anchors.push_back({d->value, d, false});
698 sec->relaxAux->anchors.push_back({d->value + d->size, d, true});
708 for (InputSection *sec : getInputSections(*osec, storage)) {
709 llvm::sort(sec->relaxAux->anchors, [](auto &a, auto &b) {
718 static void relaxCall(Ctx &ctx, const InputSection &sec, size_t i, uint64_t loc,
720 const bool rvc = getEFlags(ctx, sec.file) & EF_RISCV_RVC;
722 const uint64_t insnPair = read64le(sec.content().data() + r.offset);
729 sec.relaxAux->relocTypes[i] = R_RISCV_RVC_JUMP;
730 sec.relaxAux->writes.push_back(0xa001); // c.j
734 sec.relaxAux->relocTypes[i] = R_RISCV_RVC_JUMP;
735 sec.relaxAux->writes.push_back(0x2001); // c.jal
738 sec.relaxAux->relocTypes[i] = R_RISCV_JAL;
739 sec.relaxAux->writes.push_back(0x6f | rd << 7); // jal
745 static void relaxTlsLe(Ctx &ctx, const InputSection &sec, size_t i,
750 uint32_t insn = read32le(sec.content().data() + r.offset);
755 sec.relaxAux->relocTypes[i] = R_RISCV_RELAX;
760 sec.relaxAux->relocTypes[i] = R_RISCV_32;
762 sec.relaxAux->writes.push_back(setLO12_I(insn, val));
766 sec.relaxAux->relocTypes[i] = R_RISCV_32;
768 sec.relaxAux->writes.push_back(setLO12_S(insn, val));
773 static void relaxHi20Lo12(Ctx &ctx, const InputSection &sec, size_t i,
785 sec.relaxAux->relocTypes[i] = R_RISCV_RELAX;
789 sec.relaxAux->relocTypes[i] = INTERNAL_R_RISCV_GPREL_I;
792 sec.relaxAux->relocTypes[i] = INTERNAL_R_RISCV_GPREL_S;
797 static bool relax(Ctx &ctx, InputSection &sec) {
798 const uint64_t secAddr = sec.getVA();
799 const MutableArrayRef<Relocation> relocs = sec.relocs();
800 auto &aux = *sec.relaxAux;
832 relaxCall(ctx, sec, i, loc, r, remove);
839 relaxTlsLe(ctx, sec, i, loc, r, remove);
845 relaxHi20Lo12(ctx, sec, i, loc, r, remove);
889 sec.bytesDropped = delta;
913 for (InputSection *sec : getInputSections(*osec, storage))
914 changed |= relax(ctx, *sec);
926 for (InputSection *sec : getInputSections(*osec, storage)) {
927 RelaxAux &aux = *sec->relaxAux;
931 MutableArrayRef<Relocation> rels = sec->relocs();
932 ArrayRef<uint8_t> old = sec->content();
938 sec->content_ = p;
939 sec->size = newSize;
940 sec->bytesDropped = 0;
1047 unsigned &mergedXlen, const InputSectionBase *sec,
1051 Err(ctx) << sec << ": " << s << ": " << maybeInfo.takeError();
1170 for (const InputSectionBase *sec : sections) {
1172 if (Error e = parser.parse(sec->content(), llvm::endianness::little))
1173 Warn(ctx) << sec << ": " << std::move(e);
1181 firstStackAlign = sec;
1184 Err(ctx) << sec << " has stack_align=" << *i << " but "
1199 mergeArch(ctx, exts, xlen, sec, *s);
1213 firstAtomicAbi = sec;
1215 mergeAtomic(ctx, r.first, firstAtomicAbi, sec,