[llvm] RISCV: Remove shouldForceRelocation and unneeded relocations (PR #140692)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri May 23 18:04:07 PDT 2025


================
@@ -450,8 +450,10 @@ void MCELFStreamer::emitInstToData(const MCInst &Inst,
   auto Fixups = MutableArrayRef(DF->getFixups()).slice(FixupStartIndex);
   for (auto &Fixup : Fixups) {
     Fixup.setOffset(Fixup.getOffset() + CodeOffset);
-    if (Fixup.needsRelax())
+    if (Fixup.isLinkerRelaxable()) {
       DF->setLinkerRelaxable();
----------------
MaskRay wrote:

MCFragment::Parent can be non-null (the fragment is in a section) or null (newly created fragment, not added to a section yet).

While DF->setLinkerRelaxable could set its Parent's LinkerRelaxable, it would require MCFragment to know MCSection, which I want to avoid...

https://github.com/llvm/llvm-project/pull/140692


More information about the llvm-commits mailing list