This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: arm/thumb disassembler: display problem?


> Hi!
> 
> snipped from my __uClibc_main, compiled with gcc-3.0.3 and objdumped
> with binutils-2.11.2:
> 
>   54:   1c0f            mov     r7, r1         (add r7, r1, #0)
>   56:   480b            ldr     r0, [pc, #44]  (84 <__uClibc_main+0x34>)
>   58:   490b            ldr     r1, [pc, #44]  (88 <__uClibc_main+0x38>)
>   5a:   1c14            mov     r4, r2         (add r4, r2, #0)
> ...
>   7e:   f805f000        bl      8c <exit>
>   82:   0000            lsl     r0, r0, #0
>   84:   003c            lsl     r4, r7, #0
>   86:   0000            lsl     r0, r0, #0
>   88:   0010            lsl     r0, r2, #0
>   8a:   0000            lsl     r0, r0, #0
> 
> Look at 0x56 and 0x58: they can't be both 'ldr rx, [pc, #44]', can they?
> At least one of the loads would be misaligned. As the hardware executes
> it without complaint and the address in parenthesis shows what really
> happens I assume it's a simple bug in the display logic.
> 
> Is it obvious to those knowing the code or shall I try to produce a
> boilt down testcase?

The thumb instruction actually executes (pc & ~3) + 44 in both cases, 
which would explain why the two expanded addresses are separated by 4, not 
2.

So, strictly speaking there isn't a bug, since the rounding needs to be 
taken into account by the user, but I agree it can be a little misleading.

R.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]