]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
[RISC-V] Fix parsing flags in ELF64 files.
authorDJ Delorie <dj@redhat.com>
Fri, 9 Feb 2018 23:37:15 +0000 (18:37 -0500)
committerDJ Delorie <dj@redhat.com>
Fri, 9 Feb 2018 23:51:32 +0000 (18:51 -0500)
When ldconfig reads Elf64 files to determine the ABI, it used the
Elf32 type, so read the wrong location, and stored the wrong ABI
type in the cache, making the cache useless.  This patch uses
an Elf64 type for Elf64 objects instead.

Note that pre-patch caches might need to be manually removed and
regenerated to get the correct ABIs stored.

[BZ #22827]
* sysdeps/unix/sysv/linux/riscv/readelflib.c (process_elf_file): Use
64-bit ELF type for 64-bit ELF objects.

ChangeLog
sysdeps/unix/sysv/linux/riscv/readelflib.c

index 2063f7399b97e38b86037d99d4f2aa35509228ce..1a0ed9d05e672dd49933df813db1ed347d2a36b1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-02-09  DJ Delorie  <dj@redhat.com>
+
+       [BZ #22827]
+       * sysdeps/unix/sysv/linux/riscv/readelflib.c (process_elf_file): Use
+       64-bit ELF type for 64-bit ELF objects.
+
 2018-02-09  Joseph Myers  <joseph@codesourcery.com>
 
        * math/libm-test-driver.c (snan_tests_arg): New variable.
index 6e249ff82fa463a44beea1b179bb6557667bafac..7e27e0c1d64a814e7048e4929728208d4f17a0d2 100644 (file)
@@ -43,6 +43,7 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 {
   ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
   Elf32_Ehdr *elf32_header = (Elf32_Ehdr *) elf_header;
+  Elf64_Ehdr *elf64_header = (Elf64_Ehdr *) elf_header;
   int ret;
   long flags;
 
@@ -59,7 +60,7 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
     {
       ret = process_elf64_file (file_name, lib, flag, osversion, soname,
                                file_contents, file_length);
-      flags = elf32_header->e_flags;
+      flags = elf64_header->e_flags;
     }
 
   /* RISC-V linkers encode the floating point ABI as part of the ELF headers.  */