[PATCH] D70798: [XCOFF][AIX] Emit TOC entries for object file generation

David Tenty via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 29 13:35:15 PST 2019


daltenty added inline comments.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:281
+           "Only an initialized csect can contain TC entry.");
+    assert(!TOCCsects.empty() &&
+           "We should at least have a TOC-base in this CsectGroup.");
----------------
A bit of a question: This assumes an ordering of CSects in the MCAssembler. This works because we always create the TOC base first. Is it OK to impose ordering requirements on the MCAssembler?


================
Comment at: llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp:254
   void emitTCEntry(const MCSymbol &S) override {
-    // Object writing TOC entries not supported yet.
+    unsigned PointerSize = Is64Bit ? 8 : 4;
+    Streamer.EmitValueToAlignment(PointerSize);
----------------
Wouldn't a use of `MAI->getCodePointerSize()` be more appropriate here


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1842
       SectionKind::getData());
+  // TOC-base always have 0 size, but 4 byte alignment.
+  TOCBaseSection->setAlignment(Align(4));
----------------
nit: s/TOC-base/The TOC-base will/


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

https://reviews.llvm.org/D70798





More information about the llvm-commits mailing list