[PATCH] D71629: [SystemZ] Recognize mrecord-mcount in backend

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 18 10:00:34 PST 2019


jonpa marked an inline comment as done.
jonpa added inline comments.


================
Comment at: llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp:575
 
-  MCSymbol *fentry = Ctx.getOrCreateSymbol("__fentry__");
-  const MCSymbolRefExpr *Op =
-      MCSymbolRefExpr::create(fentry, MCSymbolRefExpr::VK_PLT, Ctx);
-  OutStreamer->EmitInstruction(MCInstBuilder(SystemZ::BRASL)
-                       .addReg(SystemZ::R0D).addExpr(Op), getSubtargetInfo());
+  if (RecordMCount) {
+    OutStreamer->SwitchSection(
----------------
uweigand wrote:
> There's no reason to split the code up this way.  You might as well do everything in the block above.
Ah, ok.


================
Comment at: llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp:578
+        Ctx.getELFSection("__mcount_loc", ELF::SHT_PROGBITS, ELF::SHF_ALLOC));
+    OutStreamer->EmitIntValue(0x1b, 8);
+    OutStreamer->SwitchSection(OutStreamer->getPreviousSection().first);
----------------
uweigand wrote:
> This is wrong, you need to emit a reference to the "DotSym" above.
> 
> I guess GCC uses the GAS unnamed label feature "1b" -- this is not the hex value 0x1b, but a backward reference to the immediately preceding instance of the "1:" label.
Ah, of course...


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

https://reviews.llvm.org/D71629





More information about the llvm-commits mailing list