public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/maskray/grte] [RISC-V] Fix parsing flags in ELF64 files.
@ 2021-08-27 23:26 Fangrui Song
  0 siblings, 0 replies; only message in thread
From: Fangrui Song @ 2021-08-27 23:26 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6cb1736f3a89ee4a4c11d188790a08769882e4f2

commit 6cb1736f3a89ee4a4c11d188790a08769882e4f2
Author: DJ Delorie <dj@redhat.com>
Date:   Fri Feb 9 18:37:15 2018 -0500

    [RISC-V] Fix parsing flags in ELF64 files.
    
    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.
    
    (cherry picked from commit 6a1ff640dcec04905d8518983ad6252d38b7a733)

Diff:
---
 ChangeLog                                  | 6 ++++++
 sysdeps/unix/sysv/linux/riscv/readelflib.c | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index cfe43e3bc0..7be7772777 100644
--- 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-07  Igor Gnatenko  <ignatenko@redhat.com>
 
 	[BZ #22797]
diff --git a/sysdeps/unix/sysv/linux/riscv/readelflib.c b/sysdeps/unix/sysv/linux/riscv/readelflib.c
index 6e249ff82f..7e27e0c1d6 100644
--- a/sysdeps/unix/sysv/linux/riscv/readelflib.c
+++ b/sysdeps/unix/sysv/linux/riscv/readelflib.c
@@ -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.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-27 23:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 23:26 [glibc/maskray/grte] [RISC-V] Fix parsing flags in ELF64 files Fangrui Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).