From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26231 invoked by alias); 24 Aug 2011 09:29:39 -0000 Received: (qmail 26223 invoked by uid 22791); 24 Aug 2011 09:29:38 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,TW_BJ X-Spam-Check-By: sourceware.org Received: from mail.windriver.com (HELO mail.windriver.com) (147.11.1.11) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 24 Aug 2011 09:29:10 +0000 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca [147.11.189.40]) by mail.windriver.com (8.14.3/8.14.3) with ESMTP id p7O9T9Mh024523 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Wed, 24 Aug 2011 02:29:09 -0700 (PDT) Received: from [128.224.162.179] (128.224.162.179) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server id 14.1.255.0; Wed, 24 Aug 2011 02:29:08 -0700 Message-ID: <4E54C45C.4010508@windriver.com> Date: Wed, 24 Aug 2011 09:29:00 -0000 From: Rongqing Li User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: Subject: Re: [PATCH 1/1] statfs64 should be weak-aliased to statfs on mips64/n64 as on X86-64 References: <1313747458-27639-1-git-send-email-rongqing.li@windriver.com> <4E4F087F.5090908@windriver.com> In-Reply-To: <4E4F087F.5090908@windriver.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2011-08/txt/msg00014.txt.bz2 Could anyone give any comments about this fix? Thanks -Roy On 08/20/2011 09:06 AM, Rongqing Li wrote: > The below is analysis for this patch. All the test is done on mips64 > > ================================== > #This program works well > > main() > { > statfs("/tmp", sfbuf); > } > ================================== > #This program does not work > > main() > { > statfs64("/tmp", sfbuf); > } > ================================== > #This program does not work if we define _FILE_OFFSET_BITS=64 > #since statfs would be linked to statfs64 on this condition > > #define _FILE_OFFSET_BITS=64 > #include <*.h> > main() > { > statfs("/tmp", sfbuf); > } > ================================== > #The below is elf information > > -bash-3.2$ readelf -h ./mabi_64/libc.so > ELF Header: > Magic: 7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00 > Class: ELF64 > Data: 2's complement, big endian > OS/ABI: UNIX - System V > ABI Version: 0 > Type: DYN (Shared object file) > Machine: MIPS R3000 > Flags: 0x60000007, noreorder, pic, cpic, mips64 > .... > > > -bash-3.2$ readelf -s ./mabi_64/libc.so |grep statfs > 6746: 00000000000ee39c 28 FUNC GLOBAL DEFAULT 11 __statfs > 6806: 00000000000ee400 8 FUNC WEAK DEFAULT 11 statfs64 > 6821: 00000000000ee39c 28 FUNC WEAK DEFAULT 11 statfs > > > -bash-3.2$ objdump -dS ./mabi_64/libc.so > > 00000000000ee39c <__statfs>: > ee39c: 2402140e li v0,5134 > ee3a0: 0000000c syscall > ee3a4: 14e0fff6 bnez a3,ee380 <__fxstatat64+0xb0> > ee3a8: 00000000 nop > ee3ac: 03e00008 jr ra > ee3b0: 00000000 nop > ... > ee3c0: 0380082d move at,gp > ee3c4: 3c1c000a lui gp,0xa > ee3c8: 279c6b14 addiu gp,gp,27412 > ee3cc: 0399e02d daddu gp,gp,t9 > ee3d0: df998588 ld t9,-31352(gp) > ee3d4: 03200008 jr t9 > ee3d8: 0020e02d move gp,at > > 00000000000ee400 : > ee400: 03e00008 jr ra > ee404: 00000000 nop > ... > > ========================================================= > The statfs64 in libc does not any work and is dummy function > since the linux kernel does not implement the statfs64 syscall > when define _MIPS_SIM_ABI64, > > the reason why statfs64 syscall is not implemented is that statfs > has equal function to statfs64 on mips64, I think. > > ========================================================= > > On x86-64, statfs64 in libc has its true implementation since > the statfs64 syscall exists in kernel. > > But statfs64 is weak-aliased to statfs at last, not call the true > statfs64 syscall on x86_64. > > The below information comes from common_pc_64. > > readelf -s libc-2.11.1.so |grep statfs > 1241: 00000000000c2350 37 FUNC GLOBAL DEFAULT 11 __statfs@@GLIBC_2.2.5 > 1564: 00000000000c2350 37 FUNC WEAK DEFAULT 11 statfs@@GLIBC_2.2.5 > 1761: 00000000000c2350 37 FUNC WEAK DEFAULT 11 statfs64@@GLIBC_2.2.5 > > ==================================================== > So I think the mips64 should have the same result. > > ==================================================== > > > On 08/19/2011 05:50 PM, rongqing.li@windriver.com wrote: >> From: Roy.Li >> >> statfs64 is null function since __NR_statfs64 is not defined when gcc >> uses _MIPS_SIM_ABI64. >> >> When macro _FILE_OFFSET_BITS=64, statfs function becomes statfs64, >> the result is these two functions can not work. >> >> Signed-off-by: Roy.Li >> --- >> .../unix/sysv/linux/mips/mips64/n64/syscalls.list | 1 + >> 1 files changed, 1 insertions(+), 0 deletions(-) >> >> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list >> b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list >> index 8d70e45..a93943d 100644 >> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list >> +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list >> @@ -5,3 +5,4 @@ sync_file_range - sync_file_range Ci:iiii sync_file_range >> prlimit EXTRA prlimit64 i:iipp prlimit prlimit64 >> >> fanotify_mark EXTRA fanotify_mark i:iiiis fanotify_mark >> +statfs - statfs i:sp __statfs statfs statfs64 > > > -- Best Reagrds, Roy | RongQing Li