[PATCH] Implement getNoopForMachoTarget for SPARC

Eric Christopher echristo at gmail.com
Wed Sep 3 18:59:27 PDT 2014


On Wed, Sep 3, 2014 at 6:09 PM, Brad Smith <brad at comstyle.com> wrote:

> 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
> .subsections_via_symbols,
>   // 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;
>     TM.getSubtargetImpl()->getInstrInfo()->getNoopForMachoTarget(Noop);
>     if (Noop.getOpcode()) {
>       OutStreamer.AddComment("avoids zero-length function");
>       OutStreamer.EmitInstruction(Noop, getSubtargetInfo());
>     } else  // Target not mc-ized yet.
>       OutStreamer.EmitRawText(StringRef("\tnop\n"));
>
>   }
>

... that's terrible.

Also it probably shouldn't be returning subsections via symbols as well.

Anyhow, let's solve the original problem better :)

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140903/36326ae4/attachment.html>


More information about the llvm-commits mailing list