ELFTC_BFD_FIND_TARGET(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’– ELFTC_BFD_FIND_TARGET(3) β€” Library Functions Manual πŸ’–

okay bestie, gather round: this is the Library Functions Manual page for the libelftc binary object descriptor girlies, and yes she ate πŸ’…

✨ NAME ✨

elftc_bfd_find_target, elftc_bfd_target_byteorder, elftc_bfd_target_class, elftc_bfd_target_flavor, elftc_bfd_target_machine β€” binary object descriptor handling, no cap πŸ¦‹

🫢 LIBRARY 🫢

library β€œlibelftc” β€” that's the one, bestie.

πŸŽ€ SYNOPSIS πŸŽ€

#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);

unsigned int
elftc_bfd_target_osabi(Elftc_Bfd_Target *target);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so elftc_bfd_find_target() is literally the lil matchmaker: it 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 β€” it's giving β€œeverything you need to know about this format” energy ✨

Known descriptor names and their properties include:

Each bullet below is Name β†’ Object Format, Byte Order, Bit Width. Zero skips, periodt.

  • binary β€” Object Format: Binary; Byte Order: -; Bit Width: -.
  • efi-app-ia32 β€” Object Format: PE; Byte Order: LSB; Bit Width: 32.
  • efi-app-x86_64 β€” Object Format: PE; Byte Order: LSB; Bit Width: 64.
  • elf32-avr β€” Object Format: ELF; Byte Order: LSB; Bit Width: 32.
  • elf32-big β€” Object Format: ELF; Byte Order: MSB; Bit Width: 32.
  • elf32-bigarm β€” Object Format: ELF; Byte Order: MSB; Bit Width: 32.
  • elf32-bigmips β€” Object Format: ELF; Byte Order: MSB; Bit Width: 32.
  • elf32-i386 β€” Object Format: ELF; Byte Order: LSB; Bit Width: 32.
  • elf32-i386-freebsd β€” Object Format: ELF; Byte Order: LSB; Bit Width: 32.
  • elf32-ia64-big β€” Object Format: ELF; Byte Order: MSB; Bit Width: 32.
  • elf32-little β€” Object Format: ELF; Byte Order: LSB; Bit Width: 32.
  • elf32-littlearm β€” Object Format: ELF; Byte Order: LSB; Bit Width: 32.
  • elf32-littlemips β€” Object Format: ELF; Byte Order: LSB; Bit Width: 32.
  • elf32-powerpc β€” Object Format: ELF; Byte Order: MSB; Bit Width: 32.
  • elf32-powerpc-freebsd β€” Object Format: ELF; Byte Order: MSB; Bit Width: 32.
  • elf32-powerpcle β€” Object Format: ELF; Byte Order: LSB; Bit Width: 32.
  • elf32-riscv β€” Object Format: ELF; Byte Order: LSB; Bit Width: 32.
  • elf64-riscv β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-riscv-freebsd β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf32-sh β€” Object Format: ELF; Byte Order: MSB; Bit Width: 32.
  • elf32-shl β€” Object Format: ELF; Byte Order: LSB; Bit Width: 32.
  • elf32-sh-nbsd β€” Object Format: ELF; Byte Order: MSB; Bit Width: 32.
  • elf32-shl-nbsd β€” Object Format: ELF; Byte Order: LSB; Bit Width: 32.
  • elf32-shbig-linux β€” Object Format: ELF; Byte Order: MSB; Bit Width: 32.
  • elf32-shl-linux β€” Object Format: ELF; Byte Order: LSB; Bit Width: 32.
  • elf32-sparc β€” Object Format: ELF; Byte Order: MSB; Bit Width: 32.
  • elf32-tradbigmips β€” Object Format: ELF; Byte Order: MSB; Bit Width: 32.
  • elf32-tradlittlemips β€” Object Format: ELF; Byte Order: LSB; Bit Width: 32.
  • elf64-alpha β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-alpha-freebsd β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-big β€” Object Format: ELF; Byte Order: MSB; Bit Width: 64.
  • elf64-bigmips β€” Object Format: ELF; Byte Order: MSB; Bit Width: 64.
  • elf64-ia64-big β€” Object Format: ELF; Byte Order: MSB; Bit Width: 64.
  • elf64-ia64-little β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-little β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-littleaarch64 β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-littlemips β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-powerpc β€” Object Format: ELF; Byte Order: MSB; Bit Width: 64.
  • elf64-powerpc-freebsd β€” Object Format: ELF; Byte Order: MSB; Bit Width: 64.
  • elf64-powerpcle β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-sh64 β€” Object Format: ELF; Byte Order: MSB; Bit Width: 64.
  • elf64-sh64l β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-sh64-nbsd β€” Object Format: ELF; Byte Order: MSB; Bit Width: 64.
  • elf64-sh64l-nbsd β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-sh64big-linux β€” Object Format: ELF; Byte Order: MSB; Bit Width: 64.
  • elf64-sh64-linux β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-sparc β€” Object Format: ELF; Byte Order: MSB; Bit Width: 64.
  • elf64-sparc-freebsd β€” Object Format: ELF; Byte Order: MSB; Bit Width: 64.
  • elf64-tradbigmips β€” Object Format: ELF; Byte Order: MSB; Bit Width: 64.
  • elf64-tradlittlemips β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-x86-64 β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • elf64-x86-64-freebsd β€” Object Format: ELF; Byte Order: LSB; Bit Width: 64.
  • ihex β€” Object Format: IHEX; Byte Order: -; Bit Width: -.
  • pei-i386 β€” Object Format: PE; Byte Order: LSB; Bit Width: 32.
  • pei-x86-64 β€” Object Format: PE; Byte Order: LSB; Bit Width: 64.
  • srec β€” Object Format: SREC; Byte Order: -; Bit Width: -.
  • symbolsrec β€” Object Format: SREC; Byte Order: -; Bit Width: -.

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

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

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

  • ETF_ELF β€” An ELF object.
  • ETF_BINARY β€” Raw binary.
  • ETF_IHEX β€” An object encoded in Intel hex format.
  • ETF_NONE β€” An unknown object format.
  • ETF_SREC β€” An object encoded as S-records.

πŸ’… RETURN VALUES πŸ’…

Function elftc_bfd_find_target() returns a valid pointer to an opaque binary target descriptor if successful, or NULL in case of an error. (We love a successful pointer, and we respect the NULL moment tbh 😭)

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.

🌈 EXAMPLES 🌈

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));

πŸ‘‘ SEE ALSO πŸ‘‘


okay that's the whole page, mwah πŸ’‹ β€” footer energy: Debian, February 12, 2020, filed under ELFTC_BFD_FIND_TARGET(3). byeee 🫢✨

πŸ“¦ where this page comes from