mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 22:10:13 +00:00
elf: Remove ldconfig kernel version check
Now that it was removed on libc.so.
This commit is contained in:
parent
b46d250656
commit
c628c22963
56
elf/cache.c
56
elf/cache.c
@ -144,7 +144,6 @@ struct cache_entry
|
|||||||
struct stringtable_entry *lib; /* Library name. */
|
struct stringtable_entry *lib; /* Library name. */
|
||||||
struct stringtable_entry *path; /* Path to find library. */
|
struct stringtable_entry *path; /* Path to find library. */
|
||||||
int flags; /* Flags to indicate kind of library. */
|
int flags; /* Flags to indicate kind of library. */
|
||||||
unsigned int osversion; /* Required OS version. */
|
|
||||||
unsigned int isa_level; /* Required ISA level. */
|
unsigned int isa_level; /* Required ISA level. */
|
||||||
uint64_t hwcap; /* Important hardware capabilities. */
|
uint64_t hwcap; /* Important hardware capabilities. */
|
||||||
int bits_hwcap; /* Number of bits set in hwcap. */
|
int bits_hwcap; /* Number of bits set in hwcap. */
|
||||||
@ -163,8 +162,8 @@ static const char *flag_descr[] =
|
|||||||
|
|
||||||
/* Print a single entry. */
|
/* Print a single entry. */
|
||||||
static void
|
static void
|
||||||
print_entry (const char *lib, int flag, unsigned int osversion,
|
print_entry (const char *lib, int flag, uint64_t hwcap,
|
||||||
uint64_t hwcap, const char *hwcap_string, const char *key)
|
const char *hwcap_string, const char *key)
|
||||||
{
|
{
|
||||||
printf ("\t%s (", lib);
|
printf ("\t%s (", lib);
|
||||||
switch (flag & FLAG_TYPE_MASK)
|
switch (flag & FLAG_TYPE_MASK)
|
||||||
@ -240,27 +239,6 @@ print_entry (const char *lib, int flag, unsigned int osversion,
|
|||||||
printf (", hwcap: \"%s\"", hwcap_string);
|
printf (", hwcap: \"%s\"", hwcap_string);
|
||||||
else if (hwcap != 0)
|
else if (hwcap != 0)
|
||||||
printf (", hwcap: %#.16" PRIx64, hwcap);
|
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);
|
printf (") => %s\n", key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,7 +371,7 @@ print_cache (const char *cache_name)
|
|||||||
/* Print everything. */
|
/* Print everything. */
|
||||||
for (unsigned int i = 0; i < cache->nlibs; i++)
|
for (unsigned int i = 0; i < cache->nlibs; i++)
|
||||||
print_entry (cache_data + cache->libs[i].key,
|
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);
|
cache_data + cache->libs[i].value);
|
||||||
}
|
}
|
||||||
else if (format == 1)
|
else if (format == 1)
|
||||||
@ -414,7 +392,6 @@ print_cache (const char *cache_name)
|
|||||||
&cache_new->libs[i]);
|
&cache_new->libs[i]);
|
||||||
print_entry (cache_data + cache_new->libs[i].key,
|
print_entry (cache_data + cache_new->libs[i].key,
|
||||||
cache_new->libs[i].flags,
|
cache_new->libs[i].flags,
|
||||||
cache_new->libs[i].osversion,
|
|
||||||
cache_new->libs[i].hwcap, hwcaps_string,
|
cache_new->libs[i].hwcap, hwcaps_string,
|
||||||
cache_data + cache_new->libs[i].value);
|
cache_data + cache_new->libs[i].value);
|
||||||
}
|
}
|
||||||
@ -467,10 +444,6 @@ compare (const struct cache_entry *e1, const struct cache_entry *e2)
|
|||||||
return 1;
|
return 1;
|
||||||
else if (e2->hwcap < e1->hwcap)
|
else if (e2->hwcap < e1->hwcap)
|
||||||
return -1;
|
return -1;
|
||||||
if (e2->osversion > e1->osversion)
|
|
||||||
return 1;
|
|
||||||
if (e2->osversion < e1->osversion)
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -671,7 +644,7 @@ save_cache (const char *cache_name)
|
|||||||
always begins at the beginning of the new cache
|
always begins at the beginning of the new cache
|
||||||
struct. */
|
struct. */
|
||||||
file_entries_new->libs[idx_new].flags = entry->flags;
|
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)
|
if (entry->hwcaps == NULL)
|
||||||
file_entries_new->libs[idx_new].hwcap = entry->hwcap;
|
file_entries_new->libs[idx_new].hwcap = entry->hwcap;
|
||||||
else
|
else
|
||||||
@ -792,8 +765,7 @@ save_cache (const char *cache_name)
|
|||||||
/* Add one library to the cache. */
|
/* Add one library to the cache. */
|
||||||
void
|
void
|
||||||
add_to_cache (const char *path, const char *filename, const char *soname,
|
add_to_cache (const char *path, const char *filename, const char *soname,
|
||||||
int flags, unsigned int osversion,
|
int flags, unsigned int isa_level, uint64_t hwcap,
|
||||||
unsigned int isa_level, uint64_t hwcap,
|
|
||||||
struct glibc_hwcaps_subdirectory *hwcaps)
|
struct glibc_hwcaps_subdirectory *hwcaps)
|
||||||
{
|
{
|
||||||
struct cache_entry *new_entry = xmalloc (sizeof (*new_entry));
|
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->lib = stringtable_add (&strings, soname);
|
||||||
new_entry->path = path_interned;
|
new_entry->path = path_interned;
|
||||||
new_entry->flags = flags;
|
new_entry->flags = flags;
|
||||||
new_entry->osversion = osversion;
|
|
||||||
new_entry->isa_level = isa_level;
|
new_entry->isa_level = isa_level;
|
||||||
new_entry->hwcap = hwcap;
|
new_entry->hwcap = hwcap;
|
||||||
new_entry->hwcaps = hwcaps;
|
new_entry->hwcaps = hwcaps;
|
||||||
@ -867,7 +838,6 @@ struct aux_cache_entry
|
|||||||
{
|
{
|
||||||
struct aux_cache_entry_id id;
|
struct aux_cache_entry_id id;
|
||||||
int flags;
|
int flags;
|
||||||
unsigned int osversion;
|
|
||||||
unsigned int isa_level;
|
unsigned int isa_level;
|
||||||
int used;
|
int used;
|
||||||
char *soname;
|
char *soname;
|
||||||
@ -881,7 +851,6 @@ struct aux_cache_file_entry
|
|||||||
struct aux_cache_entry_id id; /* Unique id of entry. */
|
struct aux_cache_entry_id id; /* Unique id of entry. */
|
||||||
int32_t flags; /* This is 1 for an ELF library. */
|
int32_t flags; /* This is 1 for an ELF library. */
|
||||||
uint32_t soname; /* String table indice. */
|
uint32_t soname; /* String table indice. */
|
||||||
uint32_t osversion; /* Required OS version. */
|
|
||||||
uint32_t isa_level; /* Required ISA level. */
|
uint32_t isa_level; /* Required ISA level. */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -932,8 +901,7 @@ init_aux_cache (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
search_aux_cache (struct stat *stat_buf, int *flags,
|
search_aux_cache (struct stat *stat_buf, int *flags, unsigned int *isa_level,
|
||||||
unsigned int *osversion, unsigned int *isa_level,
|
|
||||||
char **soname)
|
char **soname)
|
||||||
{
|
{
|
||||||
struct aux_cache_entry_id id;
|
struct aux_cache_entry_id id;
|
||||||
@ -951,7 +919,6 @@ search_aux_cache (struct stat *stat_buf, int *flags,
|
|||||||
&& id.dev == entry->id.dev)
|
&& id.dev == entry->id.dev)
|
||||||
{
|
{
|
||||||
*flags = entry->flags;
|
*flags = entry->flags;
|
||||||
*osversion = entry->osversion;
|
|
||||||
*isa_level = entry->isa_level;
|
*isa_level = entry->isa_level;
|
||||||
if (entry->soname != NULL)
|
if (entry->soname != NULL)
|
||||||
*soname = xstrdup (entry->soname);
|
*soname = xstrdup (entry->soname);
|
||||||
@ -966,8 +933,7 @@ search_aux_cache (struct stat *stat_buf, int *flags,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
insert_to_aux_cache (struct aux_cache_entry_id *id, int flags,
|
insert_to_aux_cache (struct aux_cache_entry_id *id, int flags,
|
||||||
unsigned int osversion, unsigned int isa_level,
|
unsigned int isa_level, const char *soname, int used)
|
||||||
const char *soname, int used)
|
|
||||||
{
|
{
|
||||||
size_t hash = aux_cache_entry_id_hash (id) % aux_hash_size;
|
size_t hash = aux_cache_entry_id_hash (id) % aux_hash_size;
|
||||||
struct aux_cache_entry *entry;
|
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 = xmalloc (sizeof (struct aux_cache_entry) + len);
|
||||||
entry->id = *id;
|
entry->id = *id;
|
||||||
entry->flags = flags;
|
entry->flags = flags;
|
||||||
entry->osversion = osversion;
|
|
||||||
entry->isa_level = isa_level;
|
entry->isa_level = isa_level;
|
||||||
entry->used = used;
|
entry->used = used;
|
||||||
if (soname != NULL)
|
if (soname != NULL)
|
||||||
@ -994,8 +959,7 @@ insert_to_aux_cache (struct aux_cache_entry_id *id, int flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
add_to_aux_cache (struct stat *stat_buf, int flags,
|
add_to_aux_cache (struct stat *stat_buf, int flags, unsigned int isa_level,
|
||||||
unsigned int osversion, unsigned int isa_level,
|
|
||||||
const char *soname)
|
const char *soname)
|
||||||
{
|
{
|
||||||
struct aux_cache_entry_id id;
|
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.ctime = (uint64_t) stat_buf->st_ctime;
|
||||||
id.size = (uint64_t) stat_buf->st_size;
|
id.size = (uint64_t) stat_buf->st_size;
|
||||||
id.dev = (uint64_t) stat_buf->st_dev;
|
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. */
|
/* 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)
|
for (unsigned int i = 0; i < aux_cache->nlibs; ++i)
|
||||||
insert_to_aux_cache (&aux_cache->libs[i].id,
|
insert_to_aux_cache (&aux_cache->libs[i].id,
|
||||||
aux_cache->libs[i].flags,
|
aux_cache->libs[i].flags,
|
||||||
aux_cache->libs[i].osversion,
|
|
||||||
aux_cache->libs[i].isa_level,
|
aux_cache->libs[i].isa_level,
|
||||||
aux_cache->libs[i].soname == 0
|
aux_cache->libs[i].soname == 0
|
||||||
? NULL : aux_cache_data + aux_cache->libs[i].soname,
|
? 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 = mempcpy (str, entry->soname, len);
|
||||||
str_offset += len;
|
str_offset += len;
|
||||||
}
|
}
|
||||||
file_entries->libs[idx].osversion = entry->osversion;
|
|
||||||
file_entries->libs[idx++].isa_level = entry->isa_level;
|
file_entries->libs[idx++].isa_level = entry->isa_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,7 +658,6 @@ manual_link (char *library)
|
|||||||
char *soname;
|
char *soname;
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
int flag;
|
int flag;
|
||||||
unsigned int osversion;
|
|
||||||
unsigned int isa_level;
|
unsigned int isa_level;
|
||||||
|
|
||||||
/* Prepare arguments for create_links call. Split library name in
|
/* Prepare arguments for create_links call. Split library name in
|
||||||
@ -723,8 +722,8 @@ manual_link (char *library)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process_file (real_library, library, libname, &flag, &osversion,
|
if (process_file (real_library, library, libname, &flag, &isa_level, &soname,
|
||||||
&isa_level, &soname, 0, &stat_buf))
|
0, &stat_buf))
|
||||||
{
|
{
|
||||||
error (0, 0, _("No link created since soname could not be found for %s"),
|
error (0, 0, _("No link created since soname could not be found for %s"),
|
||||||
library);
|
library);
|
||||||
@ -772,7 +771,6 @@ struct dlib_entry
|
|||||||
char *soname;
|
char *soname;
|
||||||
int flag;
|
int flag;
|
||||||
int is_link;
|
int is_link;
|
||||||
unsigned int osversion;
|
|
||||||
unsigned int isa_level;
|
unsigned int isa_level;
|
||||||
struct dlib_entry *next;
|
struct dlib_entry *next;
|
||||||
};
|
};
|
||||||
@ -991,22 +989,18 @@ search_dir (const struct dir_entry *entry)
|
|||||||
/* First search whether the auxiliary cache contains this
|
/* First search whether the auxiliary cache contains this
|
||||||
library already and it's not changed. */
|
library already and it's not changed. */
|
||||||
char *soname;
|
char *soname;
|
||||||
unsigned int osversion;
|
|
||||||
unsigned int isa_level;
|
unsigned int isa_level;
|
||||||
if (!search_aux_cache (&lstat_buf, &flag, &osversion, &isa_level,
|
if (!search_aux_cache (&lstat_buf, &flag, &isa_level, &soname))
|
||||||
&soname))
|
|
||||||
{
|
{
|
||||||
if (process_file (real_name, file_name, direntry->d_name, &flag,
|
if (process_file (real_name, file_name, direntry->d_name, &flag,
|
||||||
&osversion, &isa_level, &soname, is_link,
|
&isa_level, &soname, is_link, &lstat_buf))
|
||||||
&lstat_buf))
|
|
||||||
{
|
{
|
||||||
if (real_name != real_file_name)
|
if (real_name != real_file_name)
|
||||||
free (real_name);
|
free (real_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (opt_build_cache)
|
else if (opt_build_cache)
|
||||||
add_to_aux_cache (&lstat_buf, flag, osversion, isa_level,
|
add_to_aux_cache (&lstat_buf, flag, isa_level, soname);
|
||||||
soname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (soname == NULL)
|
if (soname == NULL)
|
||||||
@ -1111,7 +1105,6 @@ search_dir (const struct dir_entry *entry)
|
|||||||
free (dlib_ptr->name);
|
free (dlib_ptr->name);
|
||||||
dlib_ptr->name = xstrdup (direntry->d_name);
|
dlib_ptr->name = xstrdup (direntry->d_name);
|
||||||
dlib_ptr->is_link = is_link;
|
dlib_ptr->is_link = is_link;
|
||||||
dlib_ptr->osversion = osversion;
|
|
||||||
dlib_ptr->isa_level = isa_level;
|
dlib_ptr->isa_level = isa_level;
|
||||||
}
|
}
|
||||||
/* Don't add this library, abort loop. */
|
/* Don't add this library, abort loop. */
|
||||||
@ -1128,7 +1121,6 @@ search_dir (const struct dir_entry *entry)
|
|||||||
dlib_ptr->soname = soname;
|
dlib_ptr->soname = soname;
|
||||||
dlib_ptr->flag = flag;
|
dlib_ptr->flag = flag;
|
||||||
dlib_ptr->is_link = is_link;
|
dlib_ptr->is_link = is_link;
|
||||||
dlib_ptr->osversion = osversion;
|
|
||||||
dlib_ptr->isa_level = isa_level;
|
dlib_ptr->isa_level = isa_level;
|
||||||
/* Add at head of list. */
|
/* Add at head of list. */
|
||||||
dlib_ptr->next = dlibs;
|
dlib_ptr->next = dlibs;
|
||||||
@ -1166,8 +1158,8 @@ search_dir (const struct dir_entry *entry)
|
|||||||
}
|
}
|
||||||
if (opt_build_cache)
|
if (opt_build_cache)
|
||||||
add_to_cache (entry->path, filename, dlib_ptr->soname,
|
add_to_cache (entry->path, filename, dlib_ptr->soname,
|
||||||
dlib_ptr->flag, dlib_ptr->osversion,
|
dlib_ptr->flag, dlib_ptr->isa_level, hwcap,
|
||||||
dlib_ptr->isa_level, hwcap, entry->hwcaps);
|
entry->hwcaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free all resources. */
|
/* Free all resources. */
|
||||||
|
@ -40,8 +40,8 @@ do \
|
|||||||
/* Returns 0 if everything is ok, != 0 in case of error. */
|
/* Returns 0 if everything is ok, != 0 in case of error. */
|
||||||
int
|
int
|
||||||
process_elf_file (const char *file_name, const char *lib, int *flag,
|
process_elf_file (const char *file_name, const char *lib, int *flag,
|
||||||
unsigned int *osversion, unsigned int *isa_level,
|
unsigned int *isa_level, char **soname, void *file_contents,
|
||||||
char **soname, void *file_contents, size_t file_length)
|
size_t file_length)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
@ -55,7 +55,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
|
|||||||
char *dynamic_strings;
|
char *dynamic_strings;
|
||||||
|
|
||||||
elf_header = (ElfW(Ehdr) *) file_contents;
|
elf_header = (ElfW(Ehdr) *) file_contents;
|
||||||
*osversion = 0;
|
|
||||||
|
|
||||||
if (elf_header->e_ident [EI_CLASS] != ElfW (CLASS))
|
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;
|
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:
|
case PT_GNU_PROPERTY:
|
||||||
/* The NT_GNU_PROPERTY_TYPE_0 note must be aligned to 4 bytes
|
/* 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
|
in 32-bit objects and to 8 bytes in 64-bit objects. Skip
|
||||||
|
@ -72,9 +72,8 @@ is_gdb_python_file (const char *name)
|
|||||||
/* Returns 0 if everything is ok, != 0 in case of error. */
|
/* Returns 0 if everything is ok, != 0 in case of error. */
|
||||||
int
|
int
|
||||||
process_file (const char *real_file_name, const char *file_name,
|
process_file (const char *real_file_name, const char *file_name,
|
||||||
const char *lib, int *flag, unsigned int *osversion,
|
const char *lib, int *flag, unsigned int *isa_level,
|
||||||
unsigned int *isa_level, char **soname, int is_link,
|
char **soname, int is_link, struct stat *stat_buf)
|
||||||
struct stat *stat_buf)
|
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
struct stat statbuf;
|
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. */
|
/* Libraries have to be shared object files. */
|
||||||
else if (elf_header->e_type != ET_DYN)
|
else if (elf_header->e_type != ET_DYN)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
else if (process_elf_file (file_name, lib, flag, osversion, isa_level,
|
else if (process_elf_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, statbuf.st_size))
|
file_contents, statbuf.st_size))
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -95,7 +95,7 @@ struct file_entry_new
|
|||||||
uint32_t key, value; /* String table indices. */
|
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. */
|
uint64_t hwcap; /* Hwcap entry. */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,8 +70,7 @@ const char *glibc_hwcaps_subdirectory_name
|
|||||||
|
|
||||||
extern void add_to_cache (const char *path, const char *filename,
|
extern void add_to_cache (const char *path, const char *filename,
|
||||||
const char *soname, int flags,
|
const char *soname, int flags,
|
||||||
unsigned int osversion, unsigned int isa_level,
|
unsigned int isa_level, uint64_t hwcap,
|
||||||
uint64_t hwcap,
|
|
||||||
struct glibc_hwcaps_subdirectory *);
|
struct glibc_hwcaps_subdirectory *);
|
||||||
|
|
||||||
extern void init_aux_cache (void);
|
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 void load_aux_cache (const char *aux_cache_name);
|
||||||
|
|
||||||
extern int search_aux_cache (struct stat *stat_buf, int *flags,
|
extern int search_aux_cache (struct stat *stat_buf, int *flags,
|
||||||
unsigned int *osversion,
|
|
||||||
unsigned int *isa_level, char **soname);
|
unsigned int *isa_level, char **soname);
|
||||||
|
|
||||||
extern void add_to_aux_cache (struct stat *stat_buf, int flags,
|
extern void add_to_aux_cache (struct stat *stat_buf, int flags,
|
||||||
unsigned int osversion,
|
|
||||||
unsigned int isa_level, const char *soname);
|
unsigned int isa_level, const char *soname);
|
||||||
|
|
||||||
extern void save_aux_cache (const char *aux_cache_name);
|
extern void save_aux_cache (const char *aux_cache_name);
|
||||||
|
|
||||||
/* Declared in readlib.c. */
|
/* Declared in readlib.c. */
|
||||||
extern int process_file (const char *real_file_name, const char *file_name,
|
extern int process_file (const char *real_file_name, const char *file_name,
|
||||||
const char *lib, int *flag,
|
const char *lib, int *flag, unsigned int *isa_level,
|
||||||
unsigned int *osversion, unsigned int *isa_level,
|
char **soname, int is_link, struct stat *stat_buf);
|
||||||
char **soname, int is_link,
|
|
||||||
struct stat *stat_buf);
|
|
||||||
|
|
||||||
extern char *implicit_soname (const char *lib, int flag);
|
extern char *implicit_soname (const char *lib, int flag);
|
||||||
|
|
||||||
/* Declared in readelflib.c. */
|
/* Declared in readelflib.c. */
|
||||||
extern int process_elf_file (const char *file_name, const char *lib,
|
extern int process_elf_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
|
|
||||||
/* Declared in chroot_canon.c. */
|
/* Declared in chroot_canon.c. */
|
||||||
|
@ -17,19 +17,17 @@
|
|||||||
|
|
||||||
|
|
||||||
int process_elf32_file (const char *file_name, const char *lib,
|
int process_elf32_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
int process_elf64_file (const char *file_name, const char *lib,
|
int process_elf64_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
|
|
||||||
/* Returns 0 if everything is ok, != 0 in case of error. */
|
/* Returns 0 if everything is ok, != 0 in case of error. */
|
||||||
int
|
int
|
||||||
process_elf_file (const char *file_name, const char *lib, int *flag,
|
process_elf_file (const char *file_name, const char *lib, int *flag,
|
||||||
unsigned int *osversion, unsigned int *isa_level,
|
unsigned int *isa_level, char **soname, void *file_contents,
|
||||||
char **soname, void *file_contents, size_t file_length)
|
size_t file_length)
|
||||||
{
|
{
|
||||||
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
||||||
int ret;
|
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;
|
Elf32_Ehdr *elf32_header = (Elf32_Ehdr *) elf_header;
|
||||||
|
|
||||||
ret = process_elf32_file (file_name, lib, flag, osversion, isa_level,
|
ret = process_elf32_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
|
|
||||||
if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == EF_ARM_EABI_VER5)
|
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
|
else
|
||||||
{
|
{
|
||||||
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
|
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
/* AArch64 libraries are always libc.so.6+. */
|
/* AArch64 libraries are always libc.so.6+. */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
*flag = FLAG_AARCH64_LIB64|FLAG_ELF_LIBC6;
|
*flag = FLAG_AARCH64_LIB64|FLAG_ELF_LIBC6;
|
||||||
|
@ -17,30 +17,28 @@
|
|||||||
|
|
||||||
|
|
||||||
int process_elf32_file (const char *file_name, const char *lib,
|
int process_elf32_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
int process_elf64_file (const char *file_name, const char *lib,
|
int process_elf64_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
|
|
||||||
/* Returns 0 if everything is ok, != 0 in case of error. */
|
/* Returns 0 if everything is ok, != 0 in case of error. */
|
||||||
int
|
int
|
||||||
process_elf_file (const char *file_name, const char *lib, int *flag,
|
process_elf_file (const char *file_name, const char *lib, int *flag,
|
||||||
unsigned int *osversion, unsigned int *isa_level,
|
unsigned int *isa_level, char **soname, void *file_contents,
|
||||||
char **soname, void *file_contents, size_t file_length)
|
size_t file_length)
|
||||||
{
|
{
|
||||||
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
|
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
|
||||||
return process_elf32_file (file_name, lib, flag, osversion, isa_level,
|
return process_elf32_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
|
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
/* Intel 64bit libraries are always libc.so.6+. */
|
/* Intel 64bit libraries are always libc.so.6+. */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
*flag = FLAG_IA64_LIB64|FLAG_ELF_LIBC6;
|
*flag = FLAG_IA64_LIB64|FLAG_ELF_LIBC6;
|
||||||
|
@ -17,19 +17,17 @@
|
|||||||
|
|
||||||
|
|
||||||
int process_elf32_file (const char *file_name, const char *lib,
|
int process_elf32_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
int process_elf64_file (const char *file_name, const char *lib,
|
int process_elf64_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
|
|
||||||
/* Returns 0 if everything is ok, != 0 in case of error. */
|
/* Returns 0 if everything is ok, != 0 in case of error. */
|
||||||
int
|
int
|
||||||
process_elf_file (const char *file_name, const char *lib, int *flag,
|
process_elf_file (const char *file_name, const char *lib, int *flag,
|
||||||
unsigned int *osversion, unsigned int *isa_level,
|
unsigned int *isa_level, char **soname, void *file_contents,
|
||||||
char **soname, void *file_contents, size_t file_length)
|
size_t file_length)
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
@ -43,8 +41,8 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
|
|||||||
elf_header.eh = file_contents;
|
elf_header.eh = file_contents;
|
||||||
if (elf_header.eh->e_ident [EI_CLASS] == ELFCLASS32)
|
if (elf_header.eh->e_ident [EI_CLASS] == ELFCLASS32)
|
||||||
{
|
{
|
||||||
ret = process_elf32_file (file_name, lib, flag, osversion, isa_level,
|
ret = process_elf32_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
Elf32_Word flags = elf_header.eh32->e_flags;
|
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
|
else
|
||||||
{
|
{
|
||||||
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
|
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
/* n64 libraries are always libc.so.6+. */
|
/* n64 libraries are always libc.so.6+. */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
|
@ -18,30 +18,28 @@
|
|||||||
|
|
||||||
|
|
||||||
int process_elf32_file (const char *file_name, const char *lib,
|
int process_elf32_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
int process_elf64_file (const char *file_name, const char *lib,
|
int process_elf64_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
|
|
||||||
/* Returns 0 if everything is ok, != 0 in case of error. */
|
/* Returns 0 if everything is ok, != 0 in case of error. */
|
||||||
int
|
int
|
||||||
process_elf_file (const char *file_name, const char *lib, int *flag,
|
process_elf_file (const char *file_name, const char *lib, int *flag,
|
||||||
unsigned int *osversion, unsigned int *isa_level,
|
unsigned int *isa_level, char **soname, void *file_contents,
|
||||||
char **soname, void *file_contents, size_t file_length)
|
size_t file_length)
|
||||||
{
|
{
|
||||||
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
|
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
|
||||||
return process_elf32_file (file_name, lib, flag, osversion, isa_level,
|
return process_elf32_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
|
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
/* PowerPC 64bit libraries are always libc.so.6+. */
|
/* PowerPC 64bit libraries are always libc.so.6+. */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
*flag = FLAG_POWERPC_LIB64|FLAG_ELF_LIBC6;
|
*flag = FLAG_POWERPC_LIB64|FLAG_ELF_LIBC6;
|
||||||
|
@ -18,12 +18,10 @@
|
|||||||
|
|
||||||
|
|
||||||
int process_elf32_file (const char *file_name, const char *lib,
|
int process_elf32_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
int process_elf64_file (const char *file_name, const char *lib,
|
int process_elf64_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
|
|
||||||
/* The ELF flags supported by our current glibc port:
|
/* 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. */
|
/* Returns 0 if everything is ok, != 0 in case of error. */
|
||||||
int
|
int
|
||||||
process_elf_file (const char *file_name, const char *lib, int *flag,
|
process_elf_file (const char *file_name, const char *lib, int *flag,
|
||||||
unsigned int *osversion, unsigned int *isa_level,
|
unsigned int *isa_level, char **soname, void *file_contents,
|
||||||
char **soname, void *file_contents, size_t file_length)
|
size_t file_length)
|
||||||
{
|
{
|
||||||
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
||||||
Elf32_Ehdr *elf32_header = (Elf32_Ehdr *) elf_header;
|
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)
|
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
|
||||||
{
|
{
|
||||||
ret = process_elf32_file (file_name, lib, flag, osversion, isa_level,
|
ret = process_elf32_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
flags = elf32_header->e_flags;
|
flags = elf32_header->e_flags;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
|
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
flags = elf64_header->e_flags;
|
flags = elf64_header->e_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,30 +17,28 @@
|
|||||||
|
|
||||||
|
|
||||||
int process_elf32_file (const char *file_name, const char *lib,
|
int process_elf32_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
int process_elf64_file (const char *file_name, const char *lib,
|
int process_elf64_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
|
|
||||||
/* Returns 0 if everything is ok, != 0 in case of error. */
|
/* Returns 0 if everything is ok, != 0 in case of error. */
|
||||||
int
|
int
|
||||||
process_elf_file (const char *file_name, const char *lib, int *flag,
|
process_elf_file (const char *file_name, const char *lib, int *flag,
|
||||||
unsigned int *osversion, unsigned int *isa_level,
|
unsigned int *isa_level, char **soname, void *file_contents,
|
||||||
char **soname, void *file_contents, size_t file_length)
|
size_t file_length)
|
||||||
{
|
{
|
||||||
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
|
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
|
||||||
return process_elf32_file (file_name, lib, flag, osversion, isa_level,
|
return process_elf32_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
|
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
/* S/390 64bit libraries are always libc.so.6+. */
|
/* S/390 64bit libraries are always libc.so.6+. */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
*flag = FLAG_S390_LIB64|FLAG_ELF_LIBC6;
|
*flag = FLAG_S390_LIB64|FLAG_ELF_LIBC6;
|
||||||
|
@ -17,30 +17,28 @@
|
|||||||
|
|
||||||
|
|
||||||
int process_elf32_file (const char *file_name, const char *lib,
|
int process_elf32_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
int process_elf64_file (const char *file_name, const char *lib,
|
int process_elf64_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
|
|
||||||
/* Returns 0 if everything is ok, != 0 in case of error. */
|
/* Returns 0 if everything is ok, != 0 in case of error. */
|
||||||
int
|
int
|
||||||
process_elf_file (const char *file_name, const char *lib, int *flag,
|
process_elf_file (const char *file_name, const char *lib, int *flag,
|
||||||
unsigned int *osversion, unsigned int *isa_level,
|
unsigned int *isa_level, char **soname, void *file_contents,
|
||||||
char **soname, void *file_contents, size_t file_length)
|
size_t file_length)
|
||||||
{
|
{
|
||||||
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
|
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
|
||||||
return process_elf32_file (file_name, lib, flag, osversion, isa_level,
|
return process_elf32_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
|
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
/* Sparc 64bit libraries are always libc.so.6+. */
|
/* Sparc 64bit libraries are always libc.so.6+. */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
*flag = FLAG_SPARC_LIB64|FLAG_ELF_LIBC6;
|
*flag = FLAG_SPARC_LIB64|FLAG_ELF_LIBC6;
|
||||||
|
@ -16,19 +16,17 @@
|
|||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
int process_elf32_file (const char *file_name, const char *lib,
|
int process_elf32_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
int process_elf64_file (const char *file_name, const char *lib,
|
int process_elf64_file (const char *file_name, const char *lib,
|
||||||
int *flag, unsigned int *osversion,
|
int *flag, unsigned int *isa_level, char **soname,
|
||||||
unsigned int *isa_level, char **soname,
|
|
||||||
void *file_contents, size_t file_length);
|
void *file_contents, size_t file_length);
|
||||||
|
|
||||||
/* Returns 0 if everything is ok, != 0 in case of error. */
|
/* Returns 0 if everything is ok, != 0 in case of error. */
|
||||||
int
|
int
|
||||||
process_elf_file (const char *file_name, const char *lib, int *flag,
|
process_elf_file (const char *file_name, const char *lib, int *flag,
|
||||||
unsigned int *osversion, unsigned int *isa_level,
|
unsigned int *isa_level, char **soname, void *file_contents,
|
||||||
char **soname, void *file_contents, size_t file_length)
|
size_t file_length)
|
||||||
{
|
{
|
||||||
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
|
||||||
int ret, file_flag = 0;
|
int ret, file_flag = 0;
|
||||||
@ -67,11 +65,11 @@ failed:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (elf_header->e_ident[EI_CLASS] == ELFCLASS32)
|
if (elf_header->e_ident[EI_CLASS] == ELFCLASS32)
|
||||||
ret = process_elf32_file (file_name, lib, flag, osversion, isa_level,
|
ret = process_elf32_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
else
|
else
|
||||||
ret = process_elf64_file (file_name, lib, flag, osversion, isa_level,
|
ret = process_elf64_file (file_name, lib, flag, isa_level, soname,
|
||||||
soname, file_contents, file_length);
|
file_contents, file_length);
|
||||||
|
|
||||||
if (!ret && file_flag)
|
if (!ret && file_flag)
|
||||||
*flag = file_flag;
|
*flag = file_flag;
|
||||||
|
Loading…
Reference in New Issue
Block a user