3
votes

I use some third-party libraries in a project. This project is a embedded system with a MIPS(isa32r2) core. Recently we found a bug in the third-party library(libusb.a), but because of the time there is no technical support anymore. so I try to disassemble the libarary.


$ mips-sde-elf-ar -x libusb.a
$ mips-sde-elf-objdump.exe -Ds -mmips:isa32r2 -EL usbhost_func.o > usbhost_func.s

in file usbhost_func.s I can get some info like:


    Disassembly of section .text.usbhost_init:

    00000000 :
       0:   27bdffd8    addiu   sp,sp,-40
       4:   3c020000    lui v0,0x0

.text.usbhost_init looks like a complete disassembly functions of usbhost_init(). but there is some other info here like:


    Disassembly of section .pdr:

    00000000 :
       0:   00000000    nop
       4:   40000000    mfc0    zero,c0_index
       8:   fffffffc    sdc3    $31,-4(ra)
        ...         why here is  ...
      14:   00000008    jr  zero
      18:   0000001e    0x1e
      1c:   0000001f    0x1f
      20:   00000000    nop


    Disassembly of section .gnu.attributes:

    00000000 :
       0:   00000f41    0xf41
       4:   756e6700    jalx    5b99c00 
       8:   00070100    sll zero,a3,0x4
       c:   03040000    0x3040000

so my question is:

  1. What does the secton's mean like section .pdr?
  2. Why there is some ... in setion .pdr ?
  3. What is the srart point to disassemble a mips library?
    Any hint and info are welcome.Tks.
1

1 Answers

3
votes
  1. objdump -D will try to deassemble all sections instead of sections which include valid instructions, you should use objdump -d.

  2. .pdr is a debug information section, may not include valid instructions.

  3. For static libraries (.a files), you should extract the object files in these libraries by ar x libfoo.a, and try to deassemble those object files you got by objdump -d.