|
Packit |
6c4009 |
/* Special checks on libraries for ldconfig. Linux/PowerPC version.
|
|
Packit |
6c4009 |
Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
int process_elf32_file (const char *file_name, const char *lib, int *flag,
|
|
Packit |
6c4009 |
unsigned int *osversion, char **soname,
|
|
Packit |
6c4009 |
void *file_contents, size_t file_length);
|
|
Packit |
6c4009 |
int process_elf64_file (const char *file_name, const char *lib, int *flag,
|
|
Packit |
6c4009 |
unsigned int *osversion, char **soname,
|
|
Packit |
6c4009 |
void *file_contents, size_t file_length);
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Returns 0 if everything is ok, != 0 in case of error. */
|
|
Packit |
6c4009 |
int
|
|
Packit |
6c4009 |
process_elf_file (const char *file_name, const char *lib, int *flag,
|
|
Packit |
6c4009 |
unsigned int *osversion, char **soname, void *file_contents,
|
|
Packit |
6c4009 |
size_t file_length)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
|
Packit |
6c4009 |
int ret;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
|
|
Packit |
6c4009 |
return process_elf32_file (file_name, lib, flag, osversion, soname,
|
|
Packit |
6c4009 |
file_contents, file_length);
|
|
Packit |
6c4009 |
else
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
ret = process_elf64_file (file_name, lib, flag, osversion, soname,
|
|
Packit |
6c4009 |
file_contents, file_length);
|
|
Packit |
6c4009 |
/* PowerPC 64bit libraries are always libc.so.6+. */
|
|
Packit |
6c4009 |
if (!ret)
|
|
Packit |
6c4009 |
*flag = FLAG_POWERPC_LIB64|FLAG_ELF_LIBC6;
|
|
Packit |
6c4009 |
return ret;
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#undef __ELF_NATIVE_CLASS
|
|
Packit |
6c4009 |
#undef process_elf_file
|
|
Packit |
6c4009 |
#define process_elf_file process_elf32_file
|
|
Packit |
6c4009 |
#define __ELF_NATIVE_CLASS 32
|
|
Packit |
6c4009 |
#include "elf/readelflib.c"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#undef __ELF_NATIVE_CLASS
|
|
Packit |
6c4009 |
#undef process_elf_file
|
|
Packit |
6c4009 |
#define process_elf_file process_elf64_file
|
|
Packit |
6c4009 |
#define __ELF_NATIVE_CLASS 64
|
|
Packit |
6c4009 |
#include "elf/readelflib.c"
|