ELFTOC(1)

NAME
elftoc - translate an ELF file into a C struct

SYNOPSIS
elftoc [OPTIONS] FILE

DESCRIPTION
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.

OPTIONS

-e, --force-end
    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.

-E, --exclude-end
    Do not include a final _end field, even if padding is present at the end of the C struct.

-w, --width=N
    Set the maximum line width in the output to N. The default maximum line width is 80.

-i, --indent=N
    Set the number of spaces to indent to N. The default indentation amount is 2.

-s, --structname=NAME
    Set the name of the C struct in the generated source code to NAME. By default the struct's name is "elf".

-v, --varname=NAME
    Set the name of the variable in the generated source code to NAME. By default the variable's name is "foo".

-m, --allow-misaligned
    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.

-q, --quiet
    Suppress warning messages regarding invalid and contradictory values in the ELF file.

-o, --output=FILENAME
    Write the C source code to FILENAME instead of to standard output.

--help
    Display help and exit.

--version
    Display version information and exit.

COPYRIGHT
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.