ELFTOC(1) General Commands Manual ELFTOC(1)

elftoc - translate an ELF file into a C struct

elftoc [OPTIONS] FILE

elftoc takes as input an ELF file, and translates its content into a C source file describing a struct with an initialized value that matches the ELF file's memory image. Where possible, literal values are replaced with preprocessor symbols and sizeof-based calculations.

Force inclusion of a final _end field in the C struct. By default, an _end field is only included if the padding causes the struct to be larger than the original ELF file. With this option, a struct with no extra padding will provide an _end field defined as a zero-length array.
Do not include a final _end field, even if padding is present at the end of the C struct.
Set the maximum line width in the output to N. The default maximum line width is 80.
Set the number of spaces to indent to N. The default indentation amount is 2.
Set the name of the C struct in the generated source code to NAME. By default the struct's name is "elf".
Set the name of the variable in the generated source code to NAME. By default the variable's name is "foo".
A misaligned section in the ELF file would cause padding bytes to be inserted in the C struct. To avoid this, elftoc represents misaligned sections as uninterpreted byte arrays, regardless of their original type. This option suppresses this behavior, so that misaligned sections retain their actual type, even when this creates an incorrect image in the C struct.
Suppress warning messages regarding invalid and contradictory values in the ELF file.
Write the C source code to FILENAME instead of to standard output.
Display help and exit.
Display version information and exit.

Copyright © 1999, 2001, 2011 Brian Raiter <breadbox@muppetlabs.com>.

License GPLv2+: GNU GPL version 2 or later. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

May 2011 ELF kickers 3.0