[PATCH] D66724: [AIX]Emit function descriptor csect in assembly

Jason Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 13:27:56 PDT 2019


jasonliu added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1712
+  // Emit function descriptor.
+  OutStreamer->SwitchSection(const_cast<MCSectionXCOFF *>(cast<MCSymbolXCOFF>
+                             (CurrentFnDescSym)->getContainingCsect()));
----------------
The const_cast is interesting here. It makes me question if we have the right interface for getContainingCsect(). 
Maybe the getter function should return a non-const MCSectionXCOFF instead? Since SwitchSection could call Section.setIsRegistered(true) which actually modifies that MCSectionXCOFF. Would it be undefined behavior? Please correct me if I'm wrong...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66724





More information about the llvm-commits mailing list