Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
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 re-
       placed with preprocessor	symbols	and sizeof-based calculations.

       -e, --force-end
	      Force inclusion of a final _end field in the C  struct.  By  de-
	      fault,  an _end field is only included if	the padding causes the
	      struct to	be larger than the original ELF	file.  With  this  op-
	      tion,  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 max-
	      imum line	width is 80.

       -i, --indent=N
	      Set the number of	spaces to indent to N.	The  default  indenta-
	      tion 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 out-

       --help Display help and exit.

	      Display version information and exit.

       Copyright (C) 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.

ELF kickers 3.0			   May 2011			     ELFTOC(1)


Want to link to this manual page? Use this URL:

home | help