Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ elf32_newehdr(3E) — IRIX 6.5.3f

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

elf(3E)



ELFGETEHDR(3E)                                                ELFGETEHDR(3E)



NAME
     elfgetehdr: elf32getehdr, elf32newehdr, elf64getehdr, elf64newehdr -
     retrieve class-dependent object file header

SYNOPSIS
     cc [flag ...] file ...  -lelf [library ...]

     #include <libelf.h>

Elf32Ehdr *elf32getehdr(Elf *elf);
Elf32Ehdr *elf32newehdr(Elf *elf);
Elf64Ehdr *elf64getehdr(Elf *elf);
Elf64Ehdr *elf64newehdr(Elf *elf); DESCRIPTION For a 32-bit class file, elf32getehdr returns a pointer to an ELF header, if one is available for the ELF descriptor elf. If no header exists for the descriptor, elf32newehdr allocates a ``clean'' one, but it otherwise behaves the same as elf32getehdr. It does not allocate a new header if one exists already. If no header exists (for elfgetehdr), one cannot be created (for elfnewehdr), a system error occurs, the file is not a 32-bit class file, or elf is null, both functions return a null pointer. For 64-bit class files, the 64 version is applicable instead of the 32 version of the functions. The header includes the following members. unsigned char eident[EINIDENT]; Elf32Half etype; Elf32Half emachine; Elf32Word eversion; Elf32Addr eentry; Elf32Off ephoff; Elf32Off eshoff; Elf32Word eflags; Elf32Half eehsize; Elf32Half ephentsize; Elf32Half ephnum; Elf32Half eshentsize; Elf32Half eshnum; Elf32Half eshstrndx; For 64-bit class files, the following is applicable. Page 1


ELFGETEHDR(3E)                                                ELFGETEHDR(3E)



                  unsigned char   eident[EINIDENT];
                  Elf64Half      etype;
                  Elf64Half      emachine;
                  Elf64Word      eversion;
                  Elf64Addr      eentry;
                  Elf64Off       ephoff;
                  Elf64Off       eshoff;
                  Elf64Word      eflags;
                  Elf64Half      eehsize;
                  Elf64Half      ephentsize;
                  Elf64Half      ephnum;
                  Elf64Half      eshentsize;
                  Elf64Half      eshnum;
                  Elf64Half      eshstrndx;

     elf32newehdr automatically sets the ELFFDIRTY bit [see elfflag(3E)].
     A program may use elfgetident to inspect the identification bytes from a
     file.

     The 64-bit class works identically, simply replacing all instances of 32
     in the description with 64.

SEE ALSO
     elf(3E), elfbegin(3E), elfflag(3E), elfgetident(3E).































                                                                        Page 2



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026