man.bsd.lv manual page server

Manual Page Search Parameters

ELFTC_BFD_FIND_TARGET LOCAL ELFTC_BFD_FIND_TARGET

elftc_bfd_find_target, elftc_bfd_target_byteorder, elftc_bfd_target_class, elftc_bfd_target_flavor, elftc_bfd_target_machinebinary object descriptor handling

library “libelftc”

#include <libelftc.h>

struct Elftc_Bfd_Target;

Elftc_Bfd_Target *
elftc_bfd_find_target(const char *target_name);

unsigned int
elftc_bfd_target_class(Elftc_Bfd_Target *target);

unsigned int
elftc_bfd_target_byteorder(Elftc_Bfd_Target *target);

Elftc_Bfd_Target_Flavor
elftc_bfd_target_flavor(Elftc_Bfd_Target *target);

unsigned int
elftc_bfd_target_machine(Elftc_Bfd_Target *target);

Function () locates a binary object descriptor corresponding to the descriptor name in argument target_name. Binary object descriptors encapsulate properties of an object format such as its file representation, ELF class, and byte endianness.

Known descriptor names and their properties include:

Binary - -
PE LSB 32
PE LSB 64
ELF LSB 32
ELF MSB 32
ELF MSB 32
ELF MSB 32
ELF LSB 32
ELF LSB 32
ELF MSB 32
ELF LSB 32
ELF LSB 32
ELF LSB 32
ELF MSB 32
ELF MSB 32
ELF LSB 32
ELF MSB 32
ELF LSB 32
ELF MSB 32
ELF LSB 32
ELF MSB 32
ELF LSB 32
ELF MSB 32
ELF MSB 32
ELF LSB 32
ELF LSB 64
ELF LSB 64
ELF MSB 64
ELF MSB 64
ELF MSB 64
ELF LSB 64
ELF LSB 64
ELF LSB 64
ELF LSB 64
ELF MSB 64
ELF MSB 64
ELF LSB 64
ELF MSB 64
ELF LSB 64
ELF MSB 64
ELF LSB 64
ELF MSB 64
ELF LSB 64
ELF MSB 64
ELF MSB 64
ELF MSB 64
ELF LSB 64
ELF LSB 64
ELF LSB 64
IHEX - -
PE LSB 32
PE LSB 64
SREC - -
SREC - -

Function () returns the ELF byte order associated with target descriptor target.

Function () returns the ELF class associated with target descriptor target.

Function () returns the object format associated with target descriptor target. The known object formats are:

An ELF object.
Raw binary.
An object encoded in Intel hex format.
An unknown object format.
An object encoded as S-records.

Function elftc_bfd_find_target() returns a valid pointer to an opaque binary target descriptor if successful, or NULL in case of an error.

Function elftc_bfd_target_byteorder() returns the ELF byte order associated with the target descriptor; one of ELFDATA2MSB or ELFDATA2LSB.

Function elftc_bfd_target_class() returns the ELF class associated with the target descriptor; one of ELFCLASS32 or ELFCLASS64.

Function elftc_bfd_target_machine() returns the ELF architecture associated with the target descriptor.

Function elftc_bfd_target_flavor() returns one of ETF_BINARY, ETF_ELF, ETF_IHEX or ETF_SREC if successful or ETF_NONE in case of error.

To return descriptor information associated with target name “elf64-big” use:

struct Elftc_Bfd_Target *t;

if ((t = elftc_bfd_find_target("elf64-big")) == NULL)
	errx(EXIT_FAILURE, "Cannot find target descriptor");

printf("Class: %s\n", elftc_bfd_target_class(t) == ELFCLASS32 ?
    "ELFCLASS32" : "ELFCLASS64");
printf("Byteorder: %s\n",
    elftc_bfd_target_byteorder(t) == ELFDATA2LSB ? "LSB" : "MSB");
printf("Flavor: %d\n", elftc_bfd_target_flavor(t));

elf(3)

November 30, 2011 FreeBSD-12.0