]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/i386/readelflib.c
* sysdeps/unix/sysv/linux/Makefile (inhibit-siglist): Removed.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / i386 / readelflib.c
CommitLineData
a334319f 1/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
aaca11d8
UD
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>, 2000.
5
6 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
aaca11d8
UD
10
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
41bdb6e2 14 Lesser General Public License for more details.
aaca11d8 15
41bdb6e2
AJ
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
19 02111-1307 USA. */
aaca11d8
UD
20
21
22int process_elf32_file (const char *file_name, const char *lib, int *flag,
a986484f
UD
23 unsigned int *osversion, char **soname,
24 void *file_contents, size_t file_length);
aaca11d8 25int process_elf64_file (const char *file_name, const char *lib, int *flag,
a986484f
UD
26 unsigned int *osversion, char **soname,
27 void *file_contents, size_t file_length);
aaca11d8
UD
28
29/* Returns 0 if everything is ok, != 0 in case of error. */
30int
31process_elf_file (const char *file_name, const char *lib, int *flag,
a986484f
UD
32 unsigned int *osversion, char **soname, void *file_contents,
33 size_t file_length)
aaca11d8
UD
34{
35 ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
36 int ret;
37
38 if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
a986484f
UD
39 return process_elf32_file (file_name, lib, flag, osversion, soname,
40 file_contents, file_length);
aaca11d8
UD
41 else
42 {
43 switch (elf_header->e_machine)
44 {
45 case EM_IA_64:
8cbdd648 46 case EM_X86_64:
aaca11d8
UD
47 break;
48 default:
49 error (0, 0, _("%s is for unknown machine %d.\n"),
50 file_name, elf_header->e_machine);
51 return 1;
52 }
53
a986484f
UD
54 ret = process_elf64_file (file_name, lib, flag, osversion, soname,
55 file_contents, file_length);
aaca11d8
UD
56 /* IA64/X86-64 64bit libraries are always libc.so.6+. */
57 if (!ret)
58 switch (elf_header->e_machine)
59 {
60 case EM_IA_64:
61 *flag = FLAG_IA64_LIB64|FLAG_ELF_LIBC6;
62 break;
8cbdd648 63 case EM_X86_64:
aaca11d8
UD
64 *flag = FLAG_X8664_LIB64|FLAG_ELF_LIBC6;
65 break;
66 }
67
68 return ret;
69 }
70}
71
72#undef __ELF_NATIVE_CLASS
73#undef process_elf_file
74#define process_elf_file process_elf32_file
75#define __ELF_NATIVE_CLASS 32
a334319f 76#include "sysdeps/generic/readelflib.c"
aaca11d8
UD
77
78#undef __ELF_NATIVE_CLASS
79#undef process_elf_file
80#define process_elf_file process_elf64_file
81#define __ELF_NATIVE_CLASS 64
a334319f 82#include "sysdeps/generic/readelflib.c"