next up previous contents
Next: References Up: Implementation of predecode and Previous: The predecode utility

The unelf utility

Source files: src/predecode/unelf.cc

unelf uses the functions in the ELF library to expand an ELF executable into a format that can be processed by a machine without support for the ELF library. unelf loops through the ELF sections for the file. If any section contains data (which can either be instructions, initialized static data, or uninitialized data), space for that section should be allocated into the overall data array being constructed. If the ELF section actually provides data values (instructions or initialized static data), those should be copied from the section into the data array being constructed. If the section is for uninitialized static data, the corresponding region of the data array being constructed should be cleared.

After constructing a data array, the utility writes an UnElfedHeader data structure to the output file. The UnElfedHEader specifies the size of the data array, the entry point, and the virtual address for the start of the data array. Next, unelf writes the entire data array to the output file.

More information about ELF can be found from the Unix manual pages.



Vijay Sadananda Pai
Thu Aug 7 14:18:56 CDT 1997