]> sourceware.org Git - glibc.git/blame - sysdeps/unix/sysv/linux/mips/readelflib.c
Amend log entry with omitted file.
[glibc.git] / sysdeps / unix / sysv / linux / mips / readelflib.c
CommitLineData
2826ac7e 1/* Copyright (C) 1999, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
a334319f
UD
2 This file is part of the GNU C Library.
3 Contributed by Alexandre Oliva <aoliva@redhat.com>
4 Based on work ../x86_64/readelflib.c,
5 contributed by Andreas Jaeger <aj@suse.de>, 1999 and
6 Jakub Jelinek <jakub@redhat.com>, 1999.
7
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with the GNU C Library; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 02111-1307 USA. */
22
23
24int process_elf32_file (const char *file_name, const char *lib, int *flag,
25 unsigned int *osversion, char **soname,
26 void *file_contents, size_t file_length);
27int process_elf64_file (const char *file_name, const char *lib, int *flag,
28 unsigned int *osversion, char **soname,
29 void *file_contents, size_t file_length);
30
31/* Returns 0 if everything is ok, != 0 in case of error. */
32int
33process_elf_file (const char *file_name, const char *lib, int *flag,
34 unsigned int *osversion, char **soname, void *file_contents,
35 size_t file_length)
36{
37 ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
38 int ret;
39
40 if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
41 {
42 ret = process_elf32_file (file_name, lib, flag, osversion, soname,
43 file_contents, file_length);
44
45 /* n32 libraries are always libc.so.6+. */
46 if (ret && (elf_header->e_flags & EF_MIPS_ABI2) != 0)
47 *flag = FLAG_MIPS64_LIBN32|FLAG_ELF_LIBC6;
48 }
49 else
50 {
51 ret = process_elf64_file (file_name, lib, flag, osversion, soname,
52 file_contents, file_length);
53 /* n64 libraries are always libc.so.6+. */
54 if (!ret)
55 *flag = FLAG_MIPS64_LIBN64|FLAG_ELF_LIBC6;
56 }
57
58 return ret;
59}
60
61#undef __ELF_NATIVE_CLASS
62#undef process_elf_file
63#define process_elf_file process_elf32_file
64#define __ELF_NATIVE_CLASS 32
2826ac7e 65#include "elf/readelflib.c"
a334319f
UD
66
67#undef __ELF_NATIVE_CLASS
68#undef process_elf_file
69#define process_elf_file process_elf64_file
70#define __ELF_NATIVE_CLASS 64
2826ac7e 71#include "elf/readelflib.c"
This page took 0.19363 seconds and 5 git commands to generate.