DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

elf_getehdr(S-osr5)


elf_getehdr: elf32_getehdr, elf32_newehdr -- retrieve class-dependent object file header

Syntax

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

#include <libelf.h>

Elf32_Ehdr *elf32_getehdr(Elf *elf);

Elf32_Ehdr *elf32_newehdr(Elf *elf);

Description

elf32_getehdr- get pointer to an ELF table

elf32_newehdr- get pointer to an ELF table; allocate one if necessary


For a 32-bit class file, elf32_getehdr(S-osr5) returns a pointer to an ELF header, if one is available for the ELF descriptor elf. If no header exists for the descriptor, elf32_newehdr(S-osr5) allocates a new ``clean'' one, but otherwise it behaves the same as elf32_getehdr( ). It does not allocate a new header if one exists already.

The table includes the following members.

   	unsigned char	e_ident[EI_NIDENT];
   	Elf32_Half	e_type
   	Elf32_Half	e_machine
   	Elf32_Word	e_version;
   	Elf32_Addr	e_entry;
   	Elf32_Off	e_phoff;
   	Elf32_Off	e_shoff;
   	Elf32_Word	e_flags;
   	Elf32_Half	e_ehsize;
   	Elf32_Half	e_phentsize;
   	Elf32_Half	e_phnum;
   	Elf32_Half	e_shentsize;
   	Elf32_Half	e_shnum;
   	Elf32_Half	e_shstrndx;

elf32_newehdr( ) automatically sets the ELF_F_DIRTY bit (see elf_flag(S-osr5)). A program can use elf_getident(S-osr5) to inspect the identification bytes from a file.

Return values

This function returns a pointer to a program header table or NULL. Both functions allocate a null pointer under the following conditions:

Diagnostics

Error conditions are identified through the routine elf_error(S-osr5).

See also

elf(S-osr5), elf_begin(S-osr5), elf_flag(S-osr5), elf_getident(S-osr5)

Standards conformance

elf32_getehdr(S-osr5) and elf32_newehdr(S-osr5) are not part of any currently supported standard; they were developed by UNIX System Laboratories, Inc. and are maintained by The SCO Group.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005