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: Disassembly with odd sized section


Hi Nick,
Thank you very much for your reply.
Well, when --disassemble-zeroes switch is used, problem in text section is
solved but if data section is odd sized, It will still gives " Address 0x2
is out of bounds." message. Because disassembler will try to disassemble
last byte.
----------------------------------------------------
 .text
    lsl r6, r0, #4
    lsl r7, r0, #5
    lsl r0, r0, #0

.data
    .byte 0x05  ; any value
    .byte 0x06  ; any value
    .byte 0x00
----------------------------------------------
without "--disassemble-zeroes" switch

new.out:     file format elf32-littlearm

Disassembly of section .text:

00000000 <.text>:
   0:   0106            lsl     r6, r0, #4
   2:   0147            lsl     r7, r0, #5
        ...
Disassembly of section .data:

00000000 <.data>:
   0:   0605            lsl     r5, r0, #24
        ...
-------------------------------------------
with  "--disassemble-zeroes" switch
new.out:     file format elf32-littlearm

Disassembly of section .text:

00000000 <.text>:
   0:   0106            lsl     r6, r0, #4
   2:   0147            lsl     r7, r0, #5
   4:   0000            lsl     r0, r0, #0
Disassembly of section .data:

00000000 <.data>:
   0:   0605            lsl     r5, r0, #24
   2:   Address 0x2 is out of bounds.
------------------------------------------
Thanks once again.
Subhash
----- Original Message -----
From: Nick Clifton <nickc@cambridge.redhat.com>
To: Subhash Verma <subhash.verma@wipro.com>
Cc: <binutils@sourceware.cygnus.com>; binutils <binutils@sources.redhat.com>
Sent: Thursday, November 29, 2001 3:26 PM
Subject: Re: Disassembly with odd sized section


> Hi Subhash,
>
> > Disassembly of section .text:
> >
> > 00000000 <.text>:
> >    0:   0106            lsl     r6, r0, #4
> >    2:   0185            lsl     r5, r0, #6
> >    4:   Address 0x4 is out of bounds.
> >
> > Disassembly of section .data:
> >
> > 00000000 <.data>:
> >    0:   0000            lsl     r0, r0, #0
> >         ...
>
> > There is a problem in disassembler in handling the trailing byte for
> > an odd sized section.  If it is non-zero ( as in text section )it
> > gives "Address 0x4 is out of bounds" message.
>
> This is correct.  All Thumb instructions are 2 bytes long.  Therefore
> the third instruction would be at bytes 0x4 and 0x5 in the .text
> section, but byte 0x5 does not exist.  Hence the instruction at 0x4,
> if it existed, would extend into out of bounds memory.
>
> > and if it zero (like in data section) it simply replaces it with
> > "...", instead of displaying it as '0x00'.
>
> If you want to see the zeroes, just add the --disassemble-zeroes
> command line switch.
>
> >   .text
> >      lsl r6, r0, #4       ;some instruction
> >      lsl r7, r0, #5       ;some instruction
> >      lsl r0, r0, #0
>
> > 00000000 <.text>:
> >    0:   0601            lsl     r6, r0, #4
> >    2:   4701            lsl     r7, r0, #5
> >         ...
>
> > Here instead of disassembling the last instruction in text section
> > it is replaced with "...",  because its opcode is "0x0000".
> > I think it is a bug in disassembler (objdump.c) for thumb(arm).
>
> Well it is more of a feature, since it can be overcome with
> --disassemble-zeroes, and no real piece of code is going to end with
> lsl r0,r0,#0 as its last instruction.
>
> Cheers
>         Nick
>

Attachment: InterScan_Disclaimer.txt
Description: Text document


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