FAQ:Binutils

From GNU 68HC11/HC12
Jump to: navigation, search

Contents


What is readelf?

readelf is a tool which analyzes and dumps the content of any ELF file. It can be used to:

  • See which sections the program/file is composed of For this, use the following options:
   m6811-elf-readelf -S file.o
  • What are the symbols defined in the file. You can do this with:
      m6811-elf-readelf -s file.o
      
  • Dump the section content
  • Dump the debugging information

How can I disassemble the content of an object file?

You can use m6811-elf-readelf or m6811-elf-objdump to look at the content of any object file.

To disassemble the file, you can use the following command

m6811-elf-objdump -d file.o

And if you have compiled your program with debugging information (-g or --gdwarf2) you can disassemble and show the source code with the following command:

m6811-elf-objdump -S file.o

How can I generate S19 files?

There are two ways to generate S19 files:

  • By using the m6811-elf-objcopy tool.
    If you have an ELF file file.elf, you can translate it into S19 using the following command:
    m6811-elf-objcopy --output-target=srec --only-section=.text \
    		  --only-section=.rodata --only-section=.vectors \
    		   file.elf file.s19 
    	
  • By using the --oformat=srec linker option. This later option is however not recommended.
Personal tools