Updates to xtobjdis

18 views
Skip to first unread message

Alex Stewart

unread,
Oct 1, 2015, 3:53:04 PM10/1/15
to esp-open-rtos mailing list, esp82...@googlegroups.com
So FYI, starting from some suggestions by Angus, and adding in a few ideas of my own, I've gotten around to adding some options to xtobjdis to rewrite the output in various forms to make it more "idiomatic", if desired:

  --rewrite-inline-literals
                        Represent literals directly in movi/call0/etc instead
                        of using l32r
  --rewrite-remove-dotn
                        Strip trailing ".n" from narrow opcodes
  --rewrite-sr-as-arg
                        Represent the special register as a second argument to
                        RSR/WSR/XSR instead of part of the instruction name
  --rewrite-or-as-mov
                        Represent 'or r1, r2, r2' as 'mov r1, r2' instead
  --rewrite-a1-as-sp
                        Represent register a1 using its alternate name of 'sp'

Alternately, one can also just do:

  --rewrite-as-source
                        Apply all common formatting idioms to make the result
                        more source-code-like (equivalent to '--rewrite-
                        inline-literals --rewrite-remove-dotn --rewrite-sr-as-
                        arg --rewrite-or-as-mov --rewrite-a1-as-sp')

Using '--rewrite-as-source' (optionally with '--nohex') should now produce output that looks a lot more like "what a human would have written", and also output which can be fed back into an assembler again without worrying about the resulting offsets being exactly the same as the originals, etc. (which was a problem previously if one didn't supply just the right flags to the assembler to make sure it emits exactly what's specified in the input file without deviations)

(It also now correctly outputs .global / .type info for symbols and such, which in theory should have been the last fix needed to make it fully obj->asm->obj round-trippable.. I haven't had time to really thoroughly test it, though, so there might be a few remaining glitches)
Reply all
Reply to author
Forward
0 new messages