[LLVMdev] MCELFStreamer subclassing

Carter, Jack jcarter at mips.com
Tue Nov 15 09:57:20 PST 2011


Well Jim, that may just  be my problem.

As background I am working on the outer reaches of llvm for the direct object output for Mips. Part of what I am to do is instruct the folks working closer to the backend what I am getting that is incorrect. My first reaction is to assume that I am being fed things the correct way and that I am not handling it correctly.

I feed the compiler a source file (attached) -O0 that untilizes a switch statement. This produces, in Mips, an rodata section with gp relative relocations associated with it. I know this because that is what I get when producing a .s file and then running gas on it. When compiling for direct object output I got the error stemming from MCStreamer.

Since we are using MCELFStreamer, my assumption (possibly/probably wrong) was that we needed to subclass MCELFStreamer to somehow set the magic flag so that the relocation get generated.

in AsmPrinter::EmitJumpTableEntry, MJTI->getEntryKind() is of type EK_GPRel32BlockAddress.

Any insight is appreciated. I am rereading the llvm documentation. Right now it is magic to me and need to have the magic turn into knowledge.

Thanks,

Jack
________________________________________
From: Jim Grosbach [grosbach at apple.com]
Sent: Tuesday, November 15, 2011 8:57 AM
To: Carter, Jack
Cc: llvmdev at cs.uiuc.edu List; Daniel Dunbar
Subject: Re: [LLVMdev] MCELFStreamer subclassing

Hi Jack,

Can you elaborate a bit on what you're trying to do? Relocations are handled by the ObjectWriter interfaces, not by the streamer. The <ObjectFormat>Streamer classes aren't intended to be subclassed by targets.

-Jim

On Nov 14, 2011, at 5:50 PM, Carter, Jack wrote:

> I need to create a subclass that derives from MCELFStreamer.
>
> We use MCELFStreamer for direct object generation and need to override a virtual method in the base class MCStreamer::EmitGPRel32Value().
>
> I have been having trouble creating the subclass due to #include issues. I can't seem to get it right at the lib/target/<my target>/MCTargetDesc level. My first thought is always that I am doing something wrong and that may still be the issue, but it is suspicious that no one has subclassed MCELFStreamer yet.
>
> Am I missing something obvious or is this class in need of header file reorganization?
>
> Any constructive suggestion is welcome. I need to get my gp relative data relocations generated :-)
>
> Jack
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: switch.c
Type: text/x-csrc
Size: 1432 bytes
Desc: switch.c
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111115/5ee18c8a/attachment.c>


More information about the llvm-dev mailing list