toolchain
toolchain copied to clipboard
ARCv2: objdump incorrectly disassembling jump tables as random instructions (including floating point)
An ARCv2 binary was incorrectly flagged as having hw float instructions despit ethe soft-float build. Turns out that objdump can incorrectly disassemble random fragments of jump tables - embedded inline on .text.
ARCv2 codegen
sub r0,r0,129 # tmp316, param,
brhi r0, 7, @.L204 #, tmp316,,
ldb.x r0,[@.L209,r0] # tmp317,, tmp316
add_s r0,r0,@.L209 # tmp317, tmp317,
j_s [r0] # tmp317
.L209:
.byte .L213-.L209
.byte .L212-.L209
.byte .L211-.L209
.byte .L211-.L209
.byte .L204-.L209
.byte .L204-.L209
.byte .L210-.L209
.byte .L208-.L209
.align 2
ARCv2 objdump rendering of final executable (NOK)
5d29a: 2082 0042 sub r0,r0,129
5d29e: 08eb 8215 brhs.nt r0,0x8,-22 ;5d286 <stty_main+0x2ce>
5d2a2: 2633 7000 0005 d2b2 ldb.x r0,[0x5d2b2,r0]
5d2aa: 70c3 0005 d2b2 add_s r0,r0,0x5d2b2
5d2b0: 7800 j_s [r0]
5d2b2: 3608 1818 fcvt32 r24,r14,r32
^^^^^^^^
5d2b6: d4d4 ld_s r12,[pcl,0x350] ;5d604 <tail_main+0x2b0>
5d2b8: 5e50 ei_s 0x250
ARMv7 codegen
sub r0, r0, #129 @ tmp287, param,
cmp r0, #7 @ tmp287,
ldrls pc, [pc, r0, asl #2] @ tmp287
b .L228 @
.L233:
.word .L237
.word .L236
.word .L235
.word .L235
.word .L228
.word .L228
.word .L234
.word .L232
.L237:
ARMv7 objdump
bccb8: e2400081 sub r0, r0, #129 ; 0x81
bccbc: e3500007 cmp r0, #7
bccc0: 979ff100 ldrls pc, [pc, r0, lsl #2]
bccc4: eafffff2 b bcc94 <stty_main+0x474>
bccc8: 000bcce8 .word 0x000bcce8
bcccc: 000bcd24 .word 0x000bcd24
bccd0: 000bccfc .word 0x000bccfc
bccd4: 000bccfc .word 0x000bccfc
bccd8: 000bcc94 .word 0x000bcc94
bccdc: 000bcc94 .word 0x000bcc94
bcce0: 000bcd48 .word 0x000bcd48
bcce4: 000bcd60 .word 0x000bcd60
bcce8: e1a01009 mov r1, r9
ARMv8 apparently generates a seperate .rodata section
Arm is using special symbols to mark if a frag is data, arm code or thumb see chapter 4.5.5 of AAELF. The disassembler is recognizes these special symbols and it takes the appropriate action as indicated. These special symbols are added by the assembler.
@claziss I just start learning objdump flow for a ArcV2 bin, could you kindly share your command, thanks
could you kindly share your command, I want to do objdump flow for ArcV2, but the tool recognize instruction bin to data file ...