elf: Remove ldconfig kernel version check

Now that it was removed on libc.so.
This commit is contained in:
Adhemerval Zanella 2022-03-04 10:27:15 -03:00
parent b46d250656
commit c628c22963
14 changed files with 91 additions and 207 deletions

View File

@ -144,7 +144,6 @@ struct cache_entry
struct stringtable_entry *lib; /* Library name. */
struct stringtable_entry *path; /* Path to find library. */
int flags; /* Flags to indicate kind of library. */
unsigned int osversion; /* Required OS version. */
unsigned int isa_level; /* Required ISA level. */
uint64_t hwcap; /* Important hardware capabilities. */
int bits_hwcap; /* Number of bits set in hwcap. */
@ -163,8 +162,8 @@ static const char *flag_descr[] =
/* Print a single entry. */
static void
print_entry (const char *lib, int flag, unsigned int osversion,
uint64_t hwcap, const char *hwcap_string, const char *key)
print_entry (const char *lib, int flag, uint64_t hwcap,
const char *hwcap_string, const char *key)
{
printf ("\t%s (", lib);
switch (flag & FLAG_TYPE_MASK)
@ -240,27 +239,6 @@ print_entry (const char *lib, int flag, unsigned int osversion,
printf (", hwcap: \"%s\"", hwcap_string);
else if (hwcap != 0)
printf (", hwcap: %#.16" PRIx64, hwcap);
if (osversion != 0)
{
static const char *const abi_tag_os[] =
{
[0] = "Linux",
[1] = "Hurd",
[2] = "Solaris",
[3] = "FreeBSD",
[4] = "kNetBSD",
[5] = "Syllable",
[6] = N_("Unknown OS")
};
#define MAXTAG (sizeof abi_tag_os / sizeof abi_tag_os[0] - 1)
unsigned int os = osversion >> 24;
printf (_(", OS ABI: %s %d.%d.%d"),
_(abi_tag_os[os > MAXTAG ? MAXTAG : os]),
(osversion >> 16) & 0xff,
(osversion >> 8) & 0xff,
osversion & 0xff);
}
printf (") => %s\n", key);
}
@ -393,7 +371,7 @@ print_cache (const char *cache_name)
/* Print everything. */
for (unsigned int i = 0; i < cache->nlibs; i++)
print_entry (cache_data + cache->libs[i].key,
cache->libs[i].flags, 0, 0, NULL,
cache->libs[i].flags, 0, NULL,
cache_data + cache->libs[i].value);
}
else if (format == 1)
@ -414,7 +392,6 @@ print_cache (const char *cache_name)
&cache_new->libs[i]);
print_entry (cache_data + cache_new->libs[i].key,
cache_new->libs[i].flags,
cache_new->libs[i].osversion,
cache_new->libs[i].hwcap, hwcaps_string,
cache_data + cache_new->libs[i].value);
}
@ -467,10 +444,6 @@ compare (const struct cache_entry *e1, const struct cache_entry *e2)
return 1;
else if (e2->hwcap < e1->hwcap)
return -1;
if (e2->osversion > e1->osversion)
return 1;
if (e2->osversion < e1->osversion)
return -1;
}
return res;
}
@ -671,7 +644,7 @@ save_cache (const char *cache_name)
always begins at the beginning of the new cache
struct. */
file_entries_new->libs[idx_new].flags = entry->flags;
file_entries_new->libs[idx_new].osversion = entry->osversion;
file_entries_new->libs[idx_new].osversion_unused = 0;
if (entry->hwcaps == NULL)
file_entries_new->libs[idx_new].hwcap = entry->hwcap;
else
@ -792,8 +765,7 @@ save_cache (const char *cache_name)
/* Add one library to the cache. */
void
add_to_cache (const char *path, const char *filename, const char *soname,
int flags, unsigned int osversion,
unsigned int isa_level, uint64_t hwcap,
int flags, unsigned int isa_level, uint64_t hwcap,
struct glibc_hwcaps_subdirectory *hwcaps)
{
struct cache_entry *new_entry = xmalloc (sizeof (*new_entry));
@ -810,7 +782,6 @@ add_to_cache (const char *path, const char *filename, const char *soname,
new_entry->lib = stringtable_add (&strings, soname);
new_entry->path = path_interned;
new_entry->flags = flags;
new_entry->osversion = osversion;
new_entry->isa_level = isa_level;
new_entry->hwcap = hwcap;
new_entry->hwcaps = hwcaps;
@ -867,7 +838,6 @@ struct aux_cache_entry
{
struct aux_cache_entry_id id;
int flags;
unsigned int osversion;
unsigned int isa_level;
int used;
char *soname;
@ -881,7 +851,6 @@ struct aux_cache_file_entry
struct aux_cache_entry_id id; /* Unique id of entry. */
int32_t flags; /* This is 1 for an ELF library. */
uint32_t soname; /* String table indice. */
uint32_t osversion; /* Required OS version. */
uint32_t isa_level; /* Required ISA level. */
};
@ -932,8 +901,7 @@ init_aux_cache (void)
}
int
search_aux_cache (struct stat *stat_buf, int *flags,
unsigned int *osversion, unsigned int *isa_level,
search_aux_cache (struct stat *stat_buf, int *flags, unsigned int *isa_level,
char **soname)
{
struct aux_cache_entry_id id;
@ -951,7 +919,6 @@ search_aux_cache (struct stat *stat_buf, int *flags,
&& id.dev == entry->id.dev)
{
*flags = entry->flags;
*osversion = entry->osversion;
*isa_level = entry->isa_level;
if (entry->soname != NULL)
*soname = xstrdup (entry->soname);
@ -966,8 +933,7 @@ search_aux_cache (struct stat *stat_buf, int *flags,
static void
insert_to_aux_cache (struct aux_cache_entry_id *id, int flags,
unsigned int osversion, unsigned int isa_level,
const char *soname, int used)
unsigned int isa_level, const char *soname, int used)
{
size_t hash = aux_cache_entry_id_hash (id) % aux_hash_size;
struct aux_cache_entry *entry;
@ -982,7 +948,6 @@ insert_to_aux_cache (struct aux_cache_entry_id *id, int flags,
entry = xmalloc (sizeof (struct aux_cache_entry) + len);
entry->id = *id;
entry->flags = flags;
entry->osversion = osversion;
entry->isa_level = isa_level;
entry->used = used;
if (soname != NULL)
@ -994,8 +959,7 @@ insert_to_aux_cache (struct aux_cache_entry_id *id, int flags,
}
void
add_to_aux_cache (struct stat *stat_buf, int flags,
unsigned int osversion, unsigned int isa_level,
add_to_aux_cache (struct stat *stat_buf, int flags, unsigned int isa_level,
const char *soname)
{
struct aux_cache_entry_id id;
@ -1003,7 +967,7 @@ add_to_aux_cache (struct stat *stat_buf, int flags,
id.ctime = (uint64_t) stat_buf->st_ctime;
id.size = (uint64_t) stat_buf->st_size;
id.dev = (uint64_t) stat_buf->st_dev;
insert_to_aux_cache (&id, flags, osversion, isa_level, soname, 1);
insert_to_aux_cache (&id, flags, isa_level, soname, 1);
}
/* Load auxiliary cache to search for unchanged entries. */
@ -1051,7 +1015,6 @@ load_aux_cache (const char *aux_cache_name)
for (unsigned int i = 0; i < aux_cache->nlibs; ++i)
insert_to_aux_cache (&aux_cache->libs[i].id,
aux_cache->libs[i].flags,
aux_cache->libs[i].osversion,
aux_cache->libs[i].isa_level,
aux_cache->libs[i].soname == 0
? NULL : aux_cache_data + aux_cache->libs[i].soname,
@ -1120,7 +1083,6 @@ save_aux_cache (const char *aux_cache_name)
str = mempcpy (str, entry->soname, len);
str_offset += len;
}
file_entries->libs[idx].osversion = entry->osversion;
file_entries->libs[idx++].isa_level = entry->isa_level;
}

View File

@ -658,7 +658,6 @@ manual_link (char *library)
char *soname;
struct stat stat_buf;
int flag;
unsigned int osversion;
unsigned int isa_level;
/* Prepare arguments for create_links call. Split library name in
@ -723,8 +722,8 @@ manual_link (char *library)
goto out;
}
if (process_file (real_library, library, libname, &flag, &osversion,
&isa_level, &soname, 0, &stat_buf))
if (process_file (real_library, library, libname, &flag, &isa_level, &soname,
0, &stat_buf))
{
error (0, 0, _("No link created since soname could not be found for %s"),
library);
@ -772,7 +771,6 @@ struct dlib_entry
char *soname;
int flag;
int is_link;
unsigned int osversion;
unsigned int isa_level;
struct dlib_entry *next;
};
@ -991,22 +989,18 @@ search_dir (const struct dir_entry *entry)
/* First search whether the auxiliary cache contains this
library already and it's not changed. */
char *soname;
unsigned int osversion;
unsigned int isa_level;
if (!search_aux_cache (&lstat_buf, &flag, &osversion, &isa_level,
&soname))
if (!search_aux_cache (&lstat_buf, &flag, &isa_level, &soname))
{
if (process_file (real_name, file_name, direntry->d_name, &flag,
&osversion, &isa_level, &soname, is_link,
&lstat_buf))
&isa_level, &soname, is_link, &lstat_buf))
{
if (real_name != real_file_name)
free (real_name);
continue;
}
else if (opt_build_cache)
add_to_aux_cache (&lstat_buf, flag, osversion, isa_level,
soname);
add_to_aux_cache (&lstat_buf, flag, isa_level, soname);
}
if (soname == NULL)
@ -1111,7 +1105,6 @@ search_dir (const struct dir_entry *entry)
free (dlib_ptr->name);
dlib_ptr->name = xstrdup (direntry->d_name);
dlib_ptr->is_link = is_link;
dlib_ptr->osversion = osversion;
dlib_ptr->isa_level = isa_level;
}
/* Don't add this library, abort loop. */
@ -1128,7 +1121,6 @@ search_dir (const struct dir_entry *entry)
dlib_ptr->soname = soname;
dlib_ptr->flag = flag;
dlib_ptr->is_link = is_link;
dlib_ptr->osversion = osversion;
dlib_ptr->isa_level = isa_level;
/* Add at head of list. */
dlib_ptr->next = dlibs;
@ -1166,8 +1158,8 @@ search_dir (const struct dir_entry *entry)
}
if (opt_build_cache)
add_to_cache (entry->path, filename, dlib_ptr->soname,
dlib_ptr->flag, dlib_ptr->osversion,
dlib_ptr->isa_level, hwcap, entry->hwcaps);
dlib_ptr->flag, dlib_ptr->isa_level, hwcap,
entry->hwcaps);
}
/* Free all resources. */

View File

@ -40,8 +40,8 @@ do \
/* Returns 0 if everything is ok, != 0 in case of error. */
int
process_elf_file (const char *file_name, const char *lib, int *flag,
unsigned int *osversion, unsigned int *isa_level,
char **soname, void *file_contents, size_t file_length)
unsigned int *isa_level, char **soname, void *file_contents,
size_t file_length)
{
int i;
unsigned int j;
@ -55,7 +55,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
char *dynamic_strings;
elf_header = (ElfW(Ehdr) *) file_contents;
*osversion = 0;
if (elf_header->e_ident [EI_CLASS] != ElfW (CLASS))
{
@ -121,52 +120,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
}
break;
case PT_NOTE:
if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
{
ElfW(Word) *abi_note = (ElfW(Word) *) (file_contents
+ segment->p_offset);
ElfW(Addr) size = segment->p_filesz;
/* NB: Some PT_NOTE segment may have alignment value of 0
or 1. gABI specifies that PT_NOTE segments should be
aligned to 4 bytes in 32-bit objects and to 8 bytes in
64-bit objects. As a Linux extension, we also support
4 byte alignment in 64-bit objects. If p_align is less
than 4, we treate alignment as 4 bytes since some note
segments have 0 or 1 byte alignment. */
ElfW(Addr) align = segment->p_align;
if (align < 4)
align = 4;
else if (align != 4 && align != 8)
continue;
while (abi_note [0] != 4 || abi_note [1] != 16
|| abi_note [2] != 1
|| memcmp (abi_note + 3, "GNU", 4) != 0)
{
ElfW(Addr) note_size
= ELF_NOTE_NEXT_OFFSET (abi_note[0], abi_note[1],
align);
if (size - 32 < note_size || note_size == 0)
{
size = 0;
break;
}
size -= note_size;
abi_note = (void *) abi_note + note_size;
}
if (size == 0)
break;
*osversion = ((abi_note [4] << 24)
| ((abi_note [5] & 0xff) << 16)
| ((abi_note [6] & 0xff) << 8)
| (abi_note [7] & 0xff));
}
break;
case PT_GNU_PROPERTY:
/* The NT_GNU_PROPERTY_TYPE_0 note must be aligned to 4 bytes
in 32-bit objects and to 8 bytes in 64-bit objects. Skip

View File

@ -72,9 +72,8 @@ is_gdb_python_file (const char *name)
/* Returns 0 if everything is ok, != 0 in case of error. */
int
process_file (const char *real_file_name, const char *file_name,
const char *lib, int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname, int is_link,
struct stat *stat_buf)
const char *lib, int *flag, unsigned int *isa_level,
char **soname, int is_link, struct stat *stat_buf)
{
FILE *file;
struct stat statbuf;
@ -172,8 +171,8 @@ process_file (const char *real_file_name, const char *file_name,
/* Libraries have to be shared object files. */
else if (elf_header->e_type != ET_DYN)
ret = 1;
else if (process_elf_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, statbuf.st_size))
else if (process_elf_file (file_name, lib, flag, isa_level, soname,
file_contents, statbuf.st_size))
ret = 1;
done:

View File

@ -95,7 +95,7 @@ struct file_entry_new
uint32_t key, value; /* String table indices. */
};
};
uint32_t osversion; /* Required OS version. */
uint32_t osversion_unused; /* Required OS version (unused). */
uint64_t hwcap; /* Hwcap entry. */
};

View File

@ -70,8 +70,7 @@ const char *glibc_hwcaps_subdirectory_name
extern void add_to_cache (const char *path, const char *filename,
const char *soname, int flags,
unsigned int osversion, unsigned int isa_level,
uint64_t hwcap,
unsigned int isa_level, uint64_t hwcap,
struct glibc_hwcaps_subdirectory *);
extern void init_aux_cache (void);
@ -79,28 +78,23 @@ extern void init_aux_cache (void);
extern void load_aux_cache (const char *aux_cache_name);
extern int search_aux_cache (struct stat *stat_buf, int *flags,
unsigned int *osversion,
unsigned int *isa_level, char **soname);
extern void add_to_aux_cache (struct stat *stat_buf, int flags,
unsigned int osversion,
unsigned int isa_level, const char *soname);
extern void save_aux_cache (const char *aux_cache_name);
/* Declared in readlib.c. */
extern int process_file (const char *real_file_name, const char *file_name,
const char *lib, int *flag,
unsigned int *osversion, unsigned int *isa_level,
char **soname, int is_link,
struct stat *stat_buf);
const char *lib, int *flag, unsigned int *isa_level,
char **soname, int is_link, struct stat *stat_buf);
extern char *implicit_soname (const char *lib, int flag);
/* Declared in readelflib.c. */
extern int process_elf_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
/* Declared in chroot_canon.c. */

View File

@ -17,19 +17,17 @@
int process_elf32_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
int process_elf64_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
/* Returns 0 if everything is ok, != 0 in case of error. */
int
process_elf_file (const char *file_name, const char *lib, int *flag,
unsigned int *osversion, unsigned int *isa_level,
char **soname, void *file_contents, size_t file_length)
unsigned int *isa_level, char **soname, void *file_contents,
size_t file_length)
{
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
int ret;
@ -38,8 +36,8 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
{
Elf32_Ehdr *elf32_header = (Elf32_Ehdr *) elf_header;
ret = process_elf32_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
ret = process_elf32_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == EF_ARM_EABI_VER5)
{
@ -57,8 +55,8 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
}
else
{
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
/* AArch64 libraries are always libc.so.6+. */
if (!ret)
*flag = FLAG_AARCH64_LIB64|FLAG_ELF_LIBC6;

View File

@ -17,30 +17,28 @@
int process_elf32_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
int process_elf64_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
/* Returns 0 if everything is ok, != 0 in case of error. */
int
process_elf_file (const char *file_name, const char *lib, int *flag,
unsigned int *osversion, unsigned int *isa_level,
char **soname, void *file_contents, size_t file_length)
unsigned int *isa_level, char **soname, void *file_contents,
size_t file_length)
{
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
int ret;
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
return process_elf32_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
return process_elf32_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
else
{
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
/* Intel 64bit libraries are always libc.so.6+. */
if (!ret)
*flag = FLAG_IA64_LIB64|FLAG_ELF_LIBC6;

View File

@ -17,19 +17,17 @@
int process_elf32_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
int process_elf64_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
/* Returns 0 if everything is ok, != 0 in case of error. */
int
process_elf_file (const char *file_name, const char *lib, int *flag,
unsigned int *osversion, unsigned int *isa_level,
char **soname, void *file_contents, size_t file_length)
unsigned int *isa_level, char **soname, void *file_contents,
size_t file_length)
{
union
{
@ -43,8 +41,8 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
elf_header.eh = file_contents;
if (elf_header.eh->e_ident [EI_CLASS] == ELFCLASS32)
{
ret = process_elf32_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
ret = process_elf32_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
if (!ret)
{
Elf32_Word flags = elf_header.eh32->e_flags;
@ -60,8 +58,8 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
}
else
{
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
/* n64 libraries are always libc.so.6+. */
if (!ret)
{

View File

@ -18,30 +18,28 @@
int process_elf32_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
int process_elf64_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
/* Returns 0 if everything is ok, != 0 in case of error. */
int
process_elf_file (const char *file_name, const char *lib, int *flag,
unsigned int *osversion, unsigned int *isa_level,
char **soname, void *file_contents, size_t file_length)
unsigned int *isa_level, char **soname, void *file_contents,
size_t file_length)
{
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
int ret;
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
return process_elf32_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
return process_elf32_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
else
{
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
/* PowerPC 64bit libraries are always libc.so.6+. */
if (!ret)
*flag = FLAG_POWERPC_LIB64|FLAG_ELF_LIBC6;

View File

@ -18,12 +18,10 @@
int process_elf32_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
int process_elf64_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
/* The ELF flags supported by our current glibc port:
@ -40,8 +38,8 @@ int process_elf64_file (const char *file_name, const char *lib,
/* Returns 0 if everything is ok, != 0 in case of error. */
int
process_elf_file (const char *file_name, const char *lib, int *flag,
unsigned int *osversion, unsigned int *isa_level,
char **soname, void *file_contents, size_t file_length)
unsigned int *isa_level, char **soname, void *file_contents,
size_t file_length)
{
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
Elf32_Ehdr *elf32_header = (Elf32_Ehdr *) elf_header;
@ -54,14 +52,14 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
{
ret = process_elf32_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
ret = process_elf32_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
flags = elf32_header->e_flags;
}
else
{
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
flags = elf64_header->e_flags;
}

View File

@ -17,30 +17,28 @@
int process_elf32_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
int process_elf64_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
/* Returns 0 if everything is ok, != 0 in case of error. */
int
process_elf_file (const char *file_name, const char *lib, int *flag,
unsigned int *osversion, unsigned int *isa_level,
char **soname, void *file_contents, size_t file_length)
unsigned int *isa_level, char **soname, void *file_contents,
size_t file_length)
{
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
int ret;
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
return process_elf32_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
return process_elf32_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
else
{
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
/* S/390 64bit libraries are always libc.so.6+. */
if (!ret)
*flag = FLAG_S390_LIB64|FLAG_ELF_LIBC6;

View File

@ -17,30 +17,28 @@
int process_elf32_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
int process_elf64_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
/* Returns 0 if everything is ok, != 0 in case of error. */
int
process_elf_file (const char *file_name, const char *lib, int *flag,
unsigned int *osversion, unsigned int *isa_level,
char **soname, void *file_contents, size_t file_length)
unsigned int *isa_level, char **soname, void *file_contents,
size_t file_length)
{
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
int ret;
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
return process_elf32_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
return process_elf32_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
else
{
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
/* Sparc 64bit libraries are always libc.so.6+. */
if (!ret)
*flag = FLAG_SPARC_LIB64|FLAG_ELF_LIBC6;

View File

@ -16,19 +16,17 @@
<https://www.gnu.org/licenses/>. */
int process_elf32_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
int process_elf64_file (const char *file_name, const char *lib,
int *flag, unsigned int *osversion,
unsigned int *isa_level, char **soname,
int *flag, unsigned int *isa_level, char **soname,
void *file_contents, size_t file_length);
/* Returns 0 if everything is ok, != 0 in case of error. */
int
process_elf_file (const char *file_name, const char *lib, int *flag,
unsigned int *osversion, unsigned int *isa_level,
char **soname, void *file_contents, size_t file_length)
unsigned int *isa_level, char **soname, void *file_contents,
size_t file_length)
{
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
int ret, file_flag = 0;
@ -67,11 +65,11 @@ failed:
}
if (elf_header->e_ident[EI_CLASS] == ELFCLASS32)
ret = process_elf32_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
ret = process_elf32_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
else
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
soname, file_contents, file_length);
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
file_contents, file_length);
if (!ret && file_flag)
*flag = file_flag;