Update.
[glibc.git] / sysdeps / unix / sysv / linux / sparc / readelflib.c
blobf5006278bb214527451469b81815aa494bc1f214
1 /* Copyright (C) 1999 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 Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 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 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
22 int process_elf32_file (const char *file_name, const char *lib, int *flag,
23 char **soname, void *file_contents,
24 size_t file_length);
25 int process_elf64_file (const char *file_name, const char *lib, int *flag,
26 char **soname, void *file_contents,
27 size_t file_length);
29 /* Returns 0 if everything is ok, != 0 in case of error. */
30 int
31 process_elf_file (const char *file_name, const char *lib, int *flag,
32 char **soname, void *file_contents, size_t file_length)
34 ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
35 int ret;
37 if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
38 return process_elf32_file (file_name, lib, flag, soname, file_contents,
39 file_length);
40 else
42 ret = process_elf64_file (file_name, lib, flag, soname, file_contents,
43 file_length);
44 /* Sparc 64bit libraries are always libc.so.6+. */
45 if (!ret)
46 *flag = FLAG_SPARC_LIB64|FLAG_ELF_LIBC6;
47 return ret;
51 #undef __ELF_NATIVE_CLASS
52 #undef process_elf_file
53 #define process_elf_file process_elf32_file
54 #define __ELF_NATIVE_CLASS 32
55 #include "sysdeps/generic/readelflib.c"
57 #undef __ELF_NATIVE_CLASS
58 #undef process_elf_file
59 #define process_elf_file process_elf64_file
60 #define __ELF_NATIVE_CLASS 64
61 #include "sysdeps/generic/readelflib.c"