1 /* Copyright (C) 1999, 2001, 2005 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
4 Jakub Jelinek <jakub@redhat.com>, 1999.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 int process_elf32_file (const char *file_name
, const char *lib
, int *flag
,
23 unsigned int *osversion
, char **soname
,
24 void *file_contents
, size_t file_length
);
25 int process_elf64_file (const char *file_name
, const char *lib
, int *flag
,
26 unsigned int *osversion
, char **soname
,
27 void *file_contents
, size_t file_length
);
29 /* Returns 0 if everything is ok, != 0 in case of error. */
31 process_elf_file (const char *file_name
, const char *lib
, int *flag
,
32 unsigned int *osversion
, char **soname
, void *file_contents
,
35 ElfW(Ehdr
) *elf_header
= (ElfW(Ehdr
) *) file_contents
;
38 if (elf_header
->e_ident
[EI_CLASS
] == ELFCLASS32
)
39 return process_elf32_file (file_name
, lib
, flag
, osversion
, soname
,
40 file_contents
, file_length
);
43 ret
= process_elf64_file (file_name
, lib
, flag
, osversion
, soname
,
44 file_contents
, file_length
);
45 /* Sparc 64bit libraries are always libc.so.6+. */
47 *flag
= FLAG_SPARC_LIB64
|FLAG_ELF_LIBC6
;
52 #undef __ELF_NATIVE_CLASS
53 #undef process_elf_file
54 #define process_elf_file process_elf32_file
55 #define __ELF_NATIVE_CLASS 32
56 #include "elf/readelflib.c"
58 #undef __ELF_NATIVE_CLASS
59 #undef process_elf_file
60 #define process_elf_file process_elf64_file
61 #define __ELF_NATIVE_CLASS 64
62 #include "elf/readelflib.c"