ELF文件解析

 

Display the contents of the symbol table(s)

objdump --syms -F elf_file > elf_file.symbol

objdump -h -S elf_file > elf_file.header

 

$(LD) $(CODE_LDFLAGS) -T $(CODE_LD_SCR) -Map $(CODE_LD_MAP) -o $@ $^ $(CODE_LIB_OPTS) $(GCC_LIB) $(CODE_DEC_LIB_OPTS) 
$(OD) -Mno-aliases,numeric -d $@ > $@.od
$(READELF) -a $@ > $@.elf.txt
$(OC) --only-section .text -O binary $@ $@.text.bin
$(OC) --only-section .data -O binary $@ $@.data.bin

 

ld  $(LDFLAG) -T ld_script -Map out_map -o out.exe LIBS
objcopy --only-section .data -O binary elf_file out.data.bin    ##输出文件可以用于.rodata初始化
objcopy --only-section .text -O binary elf_file out.text.bin
objdump -Mno-aliases,numeric -d elf_file > elf_file.od
readelf -a elf_file > elf_file.elf.txt

 

$ objdump --help
Usage: objdump <option(s)> <file(s)>
 Display information from object <file(s)>.
 At least one of the following switches must be given:
  -a, --archive-headers    Display archive header information
  -f, --file-headers       Display the contents of the overall file header
  -p, --private-headers    Display object format specific file header contents
  -P, --private=OPT,OPT... Display object format specific contents
  -h, --[section-]headers  Display the contents of the section headers
  -x, --all-headers        Display the contents of all headers
  -d, --disassemble        Display assembler contents of executable sections
  -D, --disassemble-all    Display assembler contents of all sections
  -S, --source             Intermix source code with disassembly

 

 

https://blog.csdn.net/ccwwff
https://blog.csdn.net/ccwwff/article/details/95225279

 

posted @ 2021-03-24 11:22  sinferwu  阅读(48)  评论(0编辑  收藏  举报