Jump to content
Tuts 4 You

Disassembling ELF file format


sherl0ck

Recommended Posts

I need to design a simulator for a SPARC based customized processor. The simulator has to be able to accept a SPARC-ELF binary as its input. Does anyone have any suggestion how to extract the RAW machine code from the ELF file so that I can disassemble it programmatically & simulate the instruction?

Link to comment

If you are going to be designing an emulator, i would think that you would have some pre-requisites to learn before worrying about the coding part.

1. Learn the hardware you're going to emulate as well as you can.

2. Learn the machine language you're going to interpret and emulate.

3. Learn the file format for the input files.

Coding the emulation will benefit from these 3 things immensely because instead of all these unknown factors you will be able to isolate and identify anomolies rather than looking at it and saying "What is going wrong?"

Once you have learned a bit about the subject, you will want to look for an ELF format disassembler unless you intend to write everything yourself. Start at the beginning and the rest will unfold as you progress, try to take on too much and it will all be a mess.

HR,

Ghandi

Link to comment

Can you point me towards any tutorial which explains the concept of linking by means of practical examples? To be more precise, I want to have an example object file, run the linker & "realize" the operation done by the linker to produce the executable.

Link to comment

Can you point me towards any tutorial which explains the concept of linking by means of practical examples? To be more precise, I want to have an example object file, run the linker & "realize" the operation done by the linker to produce the executable.

GNU BinUtils (http://www.gnu.org/software/binutils/) has two programs that should be of interest to you: readelf and objdump. You should try them out on the command line to get a feel for them then you can check their sources; From what I remember neither is too complicated and they both can parse ELF files.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...