Bug 7074

Summary: mips n32 ldconfig can't produce the ld.so.cache that ld.so.1 expects
Product: glibc Reporter: Zhang Le <robert.zhangle>
Component: portsAssignee: Roland McGrath <roland>
Status: RESOLVED FIXED    
Severity: normal CC: glibc-bugs, toolchain
Priority: P2 Flags: fweimer: security-
Version: unspecified   
Target Milestone: ---   
Host: mips64el-unknown-linux-gnu Target: mips64el-unknown-linux-gnu
Build: mips64el-unknown-linux-gnu Last reconfirmed:
Project(s) to access: ssh public key:
Bug Depends on:    
Bug Blocks: 4863    

Description Zhang Le 2008-12-07 05:18:27 UTC
A patch is provided.
Comment 1 Zhang Le 2008-12-07 05:27:14 UTC
2007-07-23  Zhang Le  <r0bertz@gentoo.org>

        * ports/sysdeps/unix/sysv/linux/mips/readelflib.c (process_elf_file):
        FLAG_MIPS64_LIBN32 should be added to flag when ret is 0.
Comment 2 Zhang Le 2008-12-07 05:27:42 UTC
--- ports/sysdeps/unix/sysv/linux/mips/readelflib.c     2008-12-07
05:35:12.000000000 +0800
+++ ports/sysdeps/unix/sysv/linux/mips/readelflib.c.orig        2008-12-07
05:34:58.000000000 +0800
@@ -43,7 +43,7 @@
                                file_contents, file_length);
 
       /* n32 libraries are always libc.so.6+.  */
-      if (!ret && (elf_header->e_flags & EF_MIPS_ABI2) != 0)
+      if (ret && (elf_header->e_flags & EF_MIPS_ABI2) != 0)
        *flag = FLAG_MIPS64_LIBN32|FLAG_ELF_LIBC6;
     }
   else
Comment 3 ZHANG, Le 2008-12-07 05:30:31 UTC
sorry, the above patch is wrong. This one is correct:

--- ports/sysdeps/unix/sysv/linux/mips/readelflib.c.orig        2008-12-07
05:34:58.000000000 +0800
+++ ports/sysdeps/unix/sysv/linux/mips/readelflib.c     2008-12-07
05:35:12.000000000 +0800
@@ -43,7 +43,7 @@
                                file_contents, file_length);
 
       /* n32 libraries are always libc.so.6+.  */
-      if (ret && (elf_header->e_flags & EF_MIPS_ABI2) != 0)
+      if (!ret && (elf_header->e_flags & EF_MIPS_ABI2) != 0)
        *flag = FLAG_MIPS64_LIBN32|FLAG_ELF_LIBC6;
     }
   else
Comment 4 Sourceware Commits 2009-03-18 14:31:51 UTC
Subject: Bug 7074

CVSROOT:	/cvs/glibc
Module name:	ports
Changes by:	jsm28@sourceware.org	2009-03-18 14:31:31

Modified files:
	.              : ChangeLog.mips 
	sysdeps/unix/sysv/linux/mips: readelflib.c 

Log message:
	2009-03-18  Zhang Le  <r0bertz@gentoo.org>
	
	[BZ #7074]
	* sysdeps/unix/sysv/linux/mips/readelflib.c (process_elf_file):
	Fix the condition used to annotate n32 objects.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/ports/ChangeLog.mips.diff?cvsroot=glibc&r1=1.77&r2=1.78
http://sourceware.org/cgi-bin/cvsweb.cgi/ports/sysdeps/unix/sysv/linux/mips/readelflib.c.diff?cvsroot=glibc&r1=1.2&r2=1.3

Comment 5 Joseph Myers 2009-03-18 14:45:02 UTC
Patch committed.