[PATCH] Implement getNoopForMachoTarget for SPARC

Brad Smith brad at comstyle.com
Wed Sep 3 18:09:29 PDT 2014

On 02/09/14 3:18 AM, Joerg Sonnenberger wrote:
> On Mon, Sep 01, 2014 at 10:07:46PM -0700, Owen Anderson wrote:
>> Why are you using MachO on a SPARC target?
> See mail from me a bit ago -- because MC uses that function to ensure
> that an empty function gets at least one instruction.

Which was to try to deal with the issue of the assembler crashing..

EmitRawText called on an MCStreamer that doesn't support it,  something 
must not be fully mc'ized

from lib/CodeGen/AsmPrinter/AsmPrinter.cpp..

   // If the function is empty and the object file uses 
   // then we need to emit *something* to the function body to prevent the
   // labels from collapsing together.  Just emit a noop.
   if ((MAI->hasSubsectionsViaSymbols() && !HasAnyRealCode) || 
RequiresNoop) {
     MCInst Noop;
     if (Noop.getOpcode()) {
       OutStreamer.AddComment("avoids zero-length function");
       OutStreamer.EmitInstruction(Noop, getSubtargetInfo());
     } else  // Target not mc-ized yet.

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

More information about the llvm-commits mailing list