This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
[PATCH 2/2] MIPS: Fix n64 `ldconfig' for 32-bit objects
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: libc-ports at sourceware dot org
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, "Maciej W. Rozycki" <macro at linux-mips dot org>
- Date: Wed, 18 Mar 2009 14:12:45 +0000 (GMT)
- Subject: [PATCH 2/2] MIPS: Fix n64 `ldconfig' for 32-bit objects
Hello,
This patch, rather obvious (and coded such as to make it obvious what is
going on here), is needed on top of
http://sourceware.org/bugzilla/show_bug.cgi?id=7074 for n64 `ldconfig' to
differentiate correctly between o32 and n32 binaries when maintaining the
cache. With n64 "elf_header" is declared as (Elf64_Ehdr *) which has a
different layout to the header of 32-bit ELF files, so the fix is to cast
the pointer to the correct one, i.e. (Elf32_Ehdr *), once the magic flag
has indicated it is indeed a 32-bit file.
Verified with `ldconfig -p' to report the correct flags.
ChangeLog.mips:
2009-03-18 Maciej W. Rozycki <macro@codesourcery.com>
* sysdeps/unix/sysv/linux/mips/readelflib.c (process_elf_file):
Use the Elf32_Ehdr type to check for EF_MIPS_ABI2 in the flags.
Please apply.
Maciej
glibc-ports-2.5-mips-elf32-0.patch
Index: sysdeps/unix/sysv/linux/mips/readelflib.c
===================================================================
--- sysdeps/unix/sysv/linux/mips/readelflib.c (revision 238573)
+++ sysdeps/unix/sysv/linux/mips/readelflib.c (working copy)
@@ -39,11 +39,13 @@ process_elf_file (const char *file_name,
if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
{
+ Elf32_Ehdr *elf32_header = (Elf32_Ehdr *) elf_header;
+
ret = process_elf32_file (file_name, lib, flag, osversion, soname,
file_contents, file_length);
/* n32 libraries are always libc.so.6+. */
- if (!ret && (elf_header->e_flags & EF_MIPS_ABI2) != 0)
+ if (!ret && (elf32_header->e_flags & EF_MIPS_ABI2) != 0)
*flag = FLAG_MIPS64_LIBN32|FLAG_ELF_LIBC6;
}
else