[llvm] MC: Refine ALIGN relocation conditions (PR #150816)
    Fangrui Song via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sun Jul 27 10:23:47 PDT 2025
    
    
  
================
@@ -255,7 +255,8 @@ bool LoongArchAsmBackend::relaxAlign(MCFragment &F, unsigned &Size) {
       MCFixup::create(0, Expr, FirstLiteralRelocationKind + ELF::R_LARCH_ALIGN);
   F.setVarFixups({Fixup});
   F.setLinkerRelaxable();
-  F.getParent()->setLinkerRelaxable();
+  if (!F.getParent()->isLinkerRelaxable())
----------------
MaskRay wrote:
Note: I made minimum changes to keep LoongArch tests passing but I do not intend to apply the ALIGN optimization (first behavior in the description).
Up to a LoongArch contributor to replace `if (!F.getSubtargetInfo()->hasFeature(LoongArch::FeatureRelax))` with 
`if (F.getLayoutOrder() <= Sec->firstLinkerRelaxable())` @SixWeining @MQ-mengqing 
https://github.com/llvm/llvm-project/pull/150816
    
    
More information about the llvm-commits
mailing list