objdump

objdump:

       必选参数 –a, -d, -D, -e, -f, -g, -G, -h, -H, -p, -r, -R, -s, -S, -t, -T, -V, x

-a, --archive-header

       显示archive文件中的头部(类似 ls –l显示出的格式)同ar –t –v

--adjust-vma=offset

       when dumping information, first add offset to all the section address.

-b bfdname, --target=bfdname

       指定目标文件的目标程序格式为bfdname

       objdump可自动识别多种格式,故该参数不常用。

       例如:

              objdump –b oasys –m vax –h fu.o

-m machine, --architecture=machine

       指定进行反汇编时所用的机器

-C, --demangle[=style]

       解码低级符号名称到用户级名称,这使得C++函数名可读。

-g, --debugging

       显示调试信息

-e, --debugging-tags

       类似-g,但以ctags工具产生的文件格式显示调试信息。

-d, --disassemble

       将目标文件中的机器指令显示为汇编助记符,这个选项只反汇编这些包含指令的区

-D, --disassemble-all

       反汇编区中的所有信息

--prefix-address

       当反汇编时,在每行都显示出完整的地址信息

-EB, -EL

       指定目标文件的大小序(若文件中已指定则不需要显式地指定)

-f, --file-headers

       显示目标文件的所有头信息

-F, --file-offsets:

--file-start-context:

-h, --section-headers, --headers

       显示目标文件的区头部信息

-i, --info

       Display a list showing all architecture and object formats available for spcification with –b or –m  (-b, -m后可选的参数可以通过objdump –i来查询得到)

-j name, --section=name:

       Display information. Only for section name

-M options, --disassembler-options=options

       将指定的target信息传送给disassembler.

       若有多个-M参数,则可用”,”分开

       对于mips:

       no-aliases:显示出”raw” instruction 助记符而非伪指令助记符

       gpr-name=ABI:

              print GPR(generated-purpose register)names as appropriate for the specified ABI. By default, GPR names are selected according to the ABI of the binary being disassembled.

       fpr-names=ABI:

              print FPR(floating-point register)names as appropriate for the specified ABI. By default, FPR numbers are printed rather than names.

       cp0-names=ARCH

              print cp0(system control coprocessor; coprocessor 0) register names as appropriate for the cp0 or architecture specified by ARCH。

       reg-names=ABI:

              print GPR and FPR names as appropriate for the selected ABI

       reg-names=ARCH:

              printf CPU-specified registers names (cp0 registers and HWR names) as appropriate for the selected (cpu or architecture)。

       hwr-names=ARCH:

              print HWR(hardware register, used by the rdhwr instruction) names as appropriate for the CPU or architecture specified by ARCH。

-p, --private-headers:

       打印目标文件格式独有的信息

-r, --reloc:

       打印文件的重定位入口

-R,--dynamic-reloc:

       打印文件的动态重定位入口

-s, --full-contents:

       Display the full contents of any sections requested

-S, --source:

       同时列出source code 与disassembly

-insn-width=width

       Display width bytes on a single line when disassembling instructions

--start-address=address:

       从指定地地址处开始显示

--stop-address=address:

       在指定的地址处停止显示

-t, --syms:

       print the symbol table entries of the file. This is similar to the information provided by the program.

-T, --dynamic-syms:

       print the dynamic symbol table entries of the file.

       类似nm中的 nm –D

--specified-syms:

       dispalying symbols include those which the target considers to be specified in some way.

-x, --all-headers

       Display all available header information, include the symbol table and relocation entries. Using –x is equivalent to specifying all of –a –f –h –p –r –t

-Z, --disassemble-zeros:

       Normally the disassembly output will skip blocks of zeros.This option directs the disassembler to disassemble those blocks, just like any other data.

在unicore上测试音频,用到了asla_play,由于只在linux下测试,而不启动android,所以需要提取alsa_play所需的动态库和配置文件,

但是unicore工具中没有配置ldd,所以只能运用objdump工具

unicore32-linux-objdump -x alsa_play | grep NEEDED

得到所需的动态库

修改sdboot过程中尝试加入了几条语句,但是总是执行不起来,大概有10汇编语句。

原因1:uart端口与nand 或者sdio端口位于一组,所以在配置uart的时候可能影响了nand或者sdio配置。

原因2:尽管只有10条汇编语句,但是由于上电时硬件只能自动搬移4kb,所以加入的10条语句使得机器码大于4kb,造成部分数据寻址错误,部分指令得不到执行。

unicore32-linux-objdump -h sdboot

查看text、data、bss段大小(sdboot中不应含有bss段)是否超过4kb

为了大小在4kb内,可以去除中断向量表,尽量使用立即数,减少nop

原文地址:https://www.cnblogs.com/openix/p/2406593.html