elfnote

Display or modify the contents of an ELF note (QNX)

Syntax:

elfnote [-pv] [-n name] [-t type] [-m value [-F fmt]] [-S num [-L]]
        file [outfile]

Runs on:

QNX Neutrino, Linux, Mac, Microsoft Windows

Options:

-F n
Treat the -m option's argument as a numeric value.
-L
For a QNX note of type QNT_STACK, use lazy stack allocation.
-m value
Modify the contents of the note. See the examples.
-n name
The note name to match.
-p
Display (“print”) the notes. If you also use the -t to specify a note type, elfnote displays only that type of notes; otherwise elfnote displays all the notes. If you specify the -m option, elfnote displays the value before modification.
-S num
The stack size. This option implies -n QNX and -t QNT_STACK.
-t type
The note type to match. Acceptable values are numbers or the following QNT_* types (defined in <elfdefinitions.h>), in which case -n QNX is implied:
  • QNT_DEBUG_FULLPATH
  • QNT_DEBUG_RELOC
  • QNT_STACK
  • QNT_GENERATOR
  • QNT_DEFAULT_LIB
  • QNT_CORE_SYSINFO
  • QNT_CORE_INFO
  • QNT_CORE_STATUS
  • QNT_CORE_GREG
  • QNT_CORE_FPREG
  • QNT_LINK_MAP — you can use coreinfo to display this note in core files.

You typically use elfnote to modify QNT_STACK, as described below.

-v
Be extra verbose.

Description:

The elfnote utility displays or modifies the contents of a note in an Executable and Linkable Format file.

When you're modifying the contents of a note, you must specify both -t and -n. The value passed to -m is a hexadecimal representation of raw data. Therefore, if the note description contains (for example) numeric types, you must convert them to target endian order and represent them in hexadecimal format.

Note: You can't change the size of a note, only its contents.

For QNT_STACK, you can specify values using numeric values, in which case they must be in host endian order, and the utility will ensure correct the endian byte order. There are two values in a QNT_STACK note: stacksize and stackalloc (the amount to preallocate), both of which are unsigned 32-bit integers.

Note: Setting a stack size that's insufficient for the startup of the process, including space for arguments and environment variables (limited by _SC_ARG_MAX or ARG_MAX), may cause unexpected early failures of the process execution.

Examples:

Modify QNT_STACK to set the stacksize using a raw hexadecimal value:

elfnote -n QNX -t QNT_STACK -m 0000020000100000 filename

Modify QNT_STACK to set stacksize and stackalloc using a numeric format:

elfnote -t QNT_STACK -Fn -m 131072,4096 filename

or:

elfnote -t QNT_STACK -Fn -m 128k,4k filename

Set stacksize to 128 KB, and allocate it at thread creation time:

elfnote -S 128k file

This is equivalent to:

elfnote -Fn -m 128k,128k -tQNT_STACK -nQNX file

Specify a stack size of 128 KB, lazy allocated:

elfnote -S 128k -L file

This is equivalent to:

elfnote -Fn -m 128k,4k -tQNT_STACK -nQNX -L file