<div>Thanks Tim.  I agree, the ChangeSection strategy is not the right place to emit a mapping symbol.  I've updated the patch to override EmitInstruction().  In that function, I track the last emitted mapping symbol, and if it changes from text to code, or from arm to thumb, or thumb to arm, it will emit a new mapping symbol.  I like this strategy better because it works when both ARM and Thumb functions are present, and fixes a minor issue in the previous patch where LLVM would output a code symbol at the end of a data region even when there are no more code instructions to follow.</div>

<div><br></div><a href="https://github.com/garious/llvm/commit/ff24a528a2340df9829c18f485f7200876c5d1e8">https://github.com/garious/llvm/commit/ff24a528a2340df9829c18f485f7200876c5d1e8</a><br><div><br></div><div>Feel free to add inline commits in the web interface.  It will save be from needing to sift through emails to make sure I acknowledged each reviewers comments.  But note those comments could end up in the bitbucket after this patch is merged in.</div>

<div><br></div><div>Thanks,</div><div>Greg</div><div><br></div><div><br></div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 28, 2012 at 2:27 AM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Greg,<br>
<br>
Thanks for working on this.<br>
<div class="im"><br>
> I could use some help creating a test case for adding mixed-mode support.<br>
> Adding EmitAssemblerFlag() as Tim suggested was no problem, but creating a<br>
> test case that gets llc or llvm-mc to generate a file with both Thumb and<br>
> ARM data sections is.<br>
<br>
</div>I think the llc approach is doomed to failure for now. CodeGen just<br>
doesn't produce mixed ARM and Thumb code. That's OK though.<br>
<br>
As for llvm-mc, I agree it doesn't seem to emit the required<br>
DataRegion directives. However, temporarily hacking that into the easy<br>
places (EmitDataRegion just before EmitValue and EmitInstruction in<br>
ARMAsmParser) reveals a possibly bigger problem with the approach<br>
taken.<br>
<br>
Basically, you can't know that the first symbol emitted in a section<br>
will be a code one until you've got an instruction or .word (etc) in<br>
front of you, so ChangeSection is too early to actually emit it. For<br>
example an assembly file like:<br>
    .text<br>
    .word 42<br>
    add r0, r0, r0<br>
should produce a mapping symbol $d at offset 0, and $a/$t at offset 4.<br>
I think this is impossible with the patch as it stands.<br>
<br>
As well as ARMAsmParser.cpp, I think parts of<br>
lib/MC/MCParser/AsmParser.cpp will need to know about the regions<br>
since they handle directives like .byte, .ascii, ...<br>
<br>
Cheers.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br></div>