[PATCH] D137230: [XCOFF] avoid unnecessary Fixups when -function-sections is enabled.

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 5 20:04:28 PDT 2022


DiggerLin added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:2223
         &(MF->getFunction()), TM);
+    // If the FuncSectSym is the csect itself, the difference between FuncEnd
+    // and FuncSectSym is an absolute value. To avoid evaluating an MCExpr for
----------------
DiggerLin wrote:
> hubert.reinterpretcast wrote:
> > Can we address this where the MCExpr is handled instead? There may be more ways a similar expression involving a csect as an operand is involved in the future (e.g., assembly parsing).
>  I do not think we should set setFragment of FuncSectSym  in the function  emitTracebackTable.  
> Reason as :
> 
> 1.  because of both Asm path and   "integrated-as" enter into the function emitTracebackTable. Asm path do not have Fragment concept.
> 2.  the emitTracebackTable only do emit trace back table related thing.  we should not put other functionality here.
> 
> 
> I think we may need to set the 
> 
> The fragment value to CurrentFnSym of AsmPrinter in somewhere when "integrated-as" 
> otherwise the CurrentFnSym.isUndefined() is true.
> 
> it will cause the function MCExpr::evaluateAsRelocatableImpl() return "false" when evaluation the fixup of  CurrentFnSym-FuncEnd
> 
> 
> 
maybe you can try to set the fragment of QualName in the function MCSectionXCOFF *MCContext::getXCOFFSection.  


```
   if (Begin)
     Begin->setFragment(F);

+ if (!IsDwarfSec && CsectProp->MappingClass ==XCOFF::XMC_PR){
+    QualName->setFragment(F);
+    QualName->setOffset(0);
+  }
```

not sure whether it work or not.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137230/new/

https://reviews.llvm.org/D137230



More information about the llvm-commits mailing list