[llvm-commits] Fwd: Proof of concept patch for unifying the .s/ELF emission of .ARM.attributes

Jason Kim jasonwkim at google.com
Wed Oct 20 17:12:42 PDT 2010


On Wed, Oct 20, 2010 at 2:56 PM, Rafael Espíndola
<rafael.espindola at gmail.com> wrote:
>> Gosh, this is taking a while :-)
>> Is there anything else I missed?
>
> Another one I noticed. Instead of
>
>      SmallString<32> *FC = &currFileFragment.getContents();
>      (*FC) += static_cast<char>(attr);
>      (*FC) += static_cast<char>(0xFF & v);
>
> You can do
>
>     OutStreamer.EmitIntValue(static_cast<char>(attr), 1);
>     OutStreamer.EmitIntValue(0xFF & v, 1);
>
> No? Using the streamer interface looks a lot more in line with what
> the rest of the code does.

Hmm, I wish we had this discussion way earlier..

How would I emit things in different subsections? I can do a high
level switch to .ARM.attributes, and if I were emitting one blob from
begin to end, using the higher level interface would be preferable,
but it contains additional subsections - which are naturally
represented by MCDataFragments - Is there an MC equivalent of a
SubSection (which is-a Section so I can switch back and forth?)
Currently we only have stuff that go into the File subsection only,
but.. for futureproofing?

I pretty much duplicated style from MCELFObjectWriter.cpp, which does
muck with MCDataFragments -
(in function WriteRelocation() around line 910 of
MCELFObjectWriter.cpp )  I could not find an easier solution.
The code currently closely tracks the layout required in the section,
and its very simple, which itself was a win.

-jason

>
>> Thanks!
>>
>> -jason
>>
>
> Cheers,
> Rafael
>




More information about the llvm-commits mailing list