[llvm-commits] ARM ELF disassembly with integrated-as

Greg Fitzgerald garious at gmail.com
Wed Nov 28 18:55:49 PST 2012


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.

https://github.com/garious/llvm/commit/ff24a528a2340df9829c18f485f7200876c5d1e8

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.

Thanks,
Greg





On Wed, Nov 28, 2012 at 2:27 AM, Tim Northover <t.p.northover at gmail.com>wrote:

> Hi Greg,
>
> Thanks for working on this.
>
> > I could use some help creating a test case for adding mixed-mode support.
> > Adding EmitAssemblerFlag() as Tim suggested was no problem, but creating
> a
> > test case that gets llc or llvm-mc to generate a file with both Thumb and
> > ARM data sections is.
>
> I think the llc approach is doomed to failure for now. CodeGen just
> doesn't produce mixed ARM and Thumb code. That's OK though.
>
> As for llvm-mc, I agree it doesn't seem to emit the required
> DataRegion directives. However, temporarily hacking that into the easy
> places (EmitDataRegion just before EmitValue and EmitInstruction in
> ARMAsmParser) reveals a possibly bigger problem with the approach
> taken.
>
> Basically, you can't know that the first symbol emitted in a section
> will be a code one until you've got an instruction or .word (etc) in
> front of you, so ChangeSection is too early to actually emit it. For
> example an assembly file like:
>     .text
>     .word 42
>     add r0, r0, r0
> should produce a mapping symbol $d at offset 0, and $a/$t at offset 4.
> I think this is impossible with the patch as it stands.
>
> As well as ARMAsmParser.cpp, I think parts of
> lib/MC/MCParser/AsmParser.cpp will need to know about the regions
> since they handle directives like .byte, .ascii, ...
>
> Cheers.
>
> Tim.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121128/cb5fef08/attachment.html>


More information about the llvm-commits mailing list