diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-03-04 10:27:15 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-05-16 15:03:49 -0300 |
commit | c628c2296392ed3bf2cb8d8470668e64fe53389f (patch) | |
tree | 9b81205495c9f84e216555e5630ece715a1c1523 /elf | |
parent | b46d250656794e63a2946c481fda29271342dd1a (diff) | |
download | glibc-c628c2296392ed3bf2cb8d8470668e64fe53389f.zip glibc-c628c2296392ed3bf2cb8d8470668e64fe53389f.tar.gz glibc-c628c2296392ed3bf2cb8d8470668e64fe53389f.tar.bz2 |
elf: Remove ldconfig kernel version check
Now that it was removed on libc.so.
Diffstat (limited to 'elf')
-rw-r--r-- | elf/cache.c | 56 | ||||
-rw-r--r-- | elf/ldconfig.c | 22 | ||||
-rw-r--r-- | elf/readelflib.c | 51 | ||||
-rw-r--r-- | elf/readlib.c | 9 |
4 files changed, 22 insertions, 116 deletions
diff --git a/elf/cache.c b/elf/cache.c index dbf4c83..abe2e49 100644 --- a/elf/cache.c +++ b/elf/cache.c @@ -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; } diff --git a/elf/ldconfig.c b/elf/ldconfig.c index 57bb95e..9394ac6 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -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. */ diff --git a/elf/readelflib.c b/elf/readelflib.c index e147416..771182b 100644 --- a/elf/readelflib.c +++ b/elf/readelflib.c @@ -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 diff --git a/elf/readlib.c b/elf/readlib.c index 3651dcd..ed42fbd 100644 --- a/elf/readlib.c +++ b/elf/readlib.c @@ -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: |