Updated to fedora-glibc-20080802T0809
[glibc/history.git] / sysdeps / unix / sysv / linux / powerpc / readelflib.c
blob3c6b2daf8130950c35e3d286235a7700b563bf64
1 /* Special checks on libraries for ldconfig. Linux/PowerPC version.
2 Copyright (C) 2002, 2005 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
21 int process_elf32_file (const char *file_name, const char *lib, int *flag,
22 unsigned int *osversion, char **soname,
23 void *file_contents, size_t file_length);
24 int process_elf64_file (const char *file_name, const char *lib, int *flag,
25 unsigned int *osversion, char **soname,
26 void *file_contents, size_t file_length);
28 /* Returns 0 if everything is ok, != 0 in case of error. */
29 int
30 process_elf_file (const char *file_name, const char *lib, int *flag,
31 unsigned int *osversion, char **soname, void *file_contents,
32 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, osversion, soname,
39 file_contents, file_length);
40 else
42 ret = process_elf64_file (file_name, lib, flag, osversion, soname,
43 file_contents, file_length);
44 /* PowerPC 64bit libraries are always libc.so.6+. */
45 if (!ret)
46 *flag = FLAG_POWERPC_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 "elf/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 "elf/readelflib.c"