[LLVMdev] llvm-mc fixups

Greg Fitzgerald garious at gmail.com
Mon Sep 17 16:52:04 PDT 2012


> Showing the value for the fixup requires full object
> code layout and relaxation, which isn't done is the text-to-text path.

Their are 2 problems I'm looking to solve:

  1) How do we unit-test the integrated assembler when there are fixups?
  2) Can we avoid the duplication in encoding a fixup versus encoding an
immediate?

In the case of ADR, the fixup was properly being shifted for Thumb mode,
but the immediate was not.  In my first attempt to fix this (and another
developer as well), we patched the .td file, which fixed the immediate and
broke the fixup.

So I wonder, do all fixups require full object code layout?  For example,
in the context of Thumb, can we always convert:

        adr r0, lbl
        nop
    lbl:

into:

        adr.n r0, #0

I understand why clang's "-S" option would never want to output this syntax
(GCC doesn't grok all UAL syntax).  But for LLVM's internal assembler,
should we be trying to remove some fixups with a text-to-text pass before
encoding?  I see llvm-mc has a '-mc-relax-all' option, but doesn't seem to
do anything for me - unrelated?

Thanks,
Greg


On Wed, Sep 12, 2012 at 9:20 PM, Owen Anderson <resistor at mac.com> wrote:

> Showing the value for the fixup requires full object code layout and
> relaxation, which isn't done is the text-to-text path.
>
> --Owen
>
> On Sep 12, 2012, at 5:54 PM, Greg Fitzgerald <garious at gmail.com> wrote:
>
> When I use llvm-mc’s ‘-show-encoding’, it only goes as far as printing
> “fixups”:
>
>
> $ echo -e "adr r0, lbl\nnop\nlbl:" | llvm-mc -triple=thumbv7 -show-encoding
>
>
> Outputs:
>
> @ encoding: [A,0xa0]
>
> @    fixup A – offset: 0, value: lbl, kind: fixup_thumb_adr_pcrel_10
>
>
>
> To find out that it is encoded as 0xa001, I can do:
>
>
> $ echo -e "adr r0, lbl\nnop\nlbl:" | llvm-mc -triple=thumbv7
> -show-encoding -filetype=obj > tmp.o
>
> $ llvm-objdump -d tmp.o
>
>
> Is there a way to get that encoding directly from llvm-mc?
>
>
> Thanks,
>
> Greg
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120917/d248ba84/attachment.html>


More information about the llvm-dev mailing list