Back to index

glibc  2.9
Defines | Functions
readelflib.c File Reference
#include "elf/readelflib.c"

Go to the source code of this file.

Defines

#define process_elf_file   process_elf32_file
#define __ELF_NATIVE_CLASS   32
#define process_elf_file   process_elf64_file
#define __ELF_NATIVE_CLASS   64

Functions

int process_elf32_file (const char *file_name, const char *lib, int *flag, unsigned int *osversion, char **soname, void *file_contents, size_t file_length)
int process_elf64_file (const char *file_name, const char *lib, int *flag, unsigned int *osversion, char **soname, void *file_contents, size_t file_length)
int process_elf_file (const char *file_name, const char *lib, int *flag, unsigned int *osversion, char **soname, void *file_contents, size_t file_length)

Define Documentation

#define __ELF_NATIVE_CLASS   32

Definition at line 81 of file readelflib.c.

#define __ELF_NATIVE_CLASS   64

Definition at line 81 of file readelflib.c.

Definition at line 80 of file readelflib.c.

Definition at line 80 of file readelflib.c.


Function Documentation

int process_elf32_file ( const char *  file_name,
const char *  lib,
int flag,
unsigned int osversion,
char **  soname,
void *  file_contents,
size_t  file_length 
)
int process_elf64_file ( const char *  file_name,
const char *  lib,
int flag,
unsigned int osversion,
char **  soname,
void *  file_contents,
size_t  file_length 
)
int process_elf_file ( const char *  file_name,
const char *  lib,
int flag,
unsigned int osversion,
char **  soname,
void *  file_contents,
size_t  file_length 
)

Definition at line 31 of file readelflib.c.

{
  ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
  int ret;

  if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
    return process_elf32_file (file_name, lib, flag, osversion, soname,
                            file_contents, file_length);
  else
    {
      switch (elf_header->e_machine)
       {
       case EM_IA_64:
       case EM_X86_64:
         break;
       default:
         error (0, 0, _("%s is for unknown machine %d.\n"),
               file_name, elf_header->e_machine);
         return 1;
       }

      ret = process_elf64_file (file_name, lib, flag, osversion, soname,
                            file_contents, file_length);
      /* IA64/X86-64 64bit libraries are always libc.so.6+.  */
      if (!ret)
       switch (elf_header->e_machine)
         {
         case EM_IA_64:
           *flag = FLAG_IA64_LIB64|FLAG_ELF_LIBC6;
           break;
         case EM_X86_64:
           *flag = FLAG_X8664_LIB64|FLAG_ELF_LIBC6;
           break;
         }

      return ret;
    }
}

Here is the call graph for this function: