From patchwork Fri Jun 24 12:23:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 102086 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp920397qgy; Fri, 24 Jun 2016 05:23:39 -0700 (PDT) X-Received: by 10.66.245.111 with SMTP id xn15mr7233902pac.76.1466771019232; Fri, 24 Jun 2016 05:23:39 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id c2si6588342pfb.198.2016.06.24.05.23.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jun 2016 05:23:39 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-71037-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-71037-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-71037-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type; q=dns; s=default; b=QIx6MwhyXL6xFhjg oVRs1rr2KdVzvlO/CSLjt/A/QuONtEbW12uePD6k1Yl0ARJ4egyGQHvsN42pCNji NI2+ous2z6Aoni1LAAh+UyxP0fsa+2U9qFQvzddcel88ydQp1vKzxbaR9QMAV+Yr Xp8uVaQkJYqqfiw8xVPPtEJOxdI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type; s=default; bh=5gFt9Ifmu5wr+RJ7bVY8ix hAAhg=; b=DIkvS60iYctOtVyOh4qWrb1Y1qQydf6gFyMsFLVxvLP5hIMK4H4VdD Es7ustkfZuVONJlI9bX2jL50il/bU1J3Z/WDmq/ul6aYUT2Teo5ILGPWD6JCddW+ wz48T0oAqpEgWWWRFsksYWwrZ1WoZXS+B5zRgdkczyOpwXu43W4eg= Received: (qmail 101699 invoked by alias); 24 Jun 2016 12:23:30 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 101682 invoked by uid 89); 24 Jun 2016 12:23:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=HTo:D*gentoo.org, 35, 5, 20, 8 X-HELO: na01-bl2-obe.outbound.protection.outlook.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; From: Yury Norov To: , , CC: , , , Yury Norov Subject: [PATCH] off_t: fix register pair calculation for 64-bit case Date: Fri, 24 Jun 2016 15:23:00 +0300 Message-ID: <1466770980-18933-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-ClientProxiedBy: HE1PR01CA0053.eurprd01.prod.exchangelabs.com (10.165.170.149) To DM3PR07MB2252.namprd07.prod.outlook.com (10.164.33.150) X-MS-Office365-Filtering-Correlation-Id: 600def00-99ae-44b1-0cf0-08d39c2a5118 X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2252; 2:5vCvFYr5bERcp0qy2aZt1Ffa6J3pl84n6j6x1Z2OV7xSz52qS3YewAsoMQqd1hkbQeDYCYm5VI+nQh0Ls38JjhfyIcJDgL+OFOkFs8nFZvCWiONxzJgVFpHEWvlOnJEpCnWlqSC3UvEmY1Uojejv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WgKvZZB1Zbp+j8P1+fqv4a1y5tl0xU6VtAlIhob4XFJaFnzS4+tdYUOkfHmdyyfXzduscrdj8pQ3TADvHK0+qEcxAyuEbMpTP/pR+ndQs68A52Ta9ISrKUJr6D3qzbzBmSGYubkNhbasVbgjfh8jbCMGyVumQlNGEAiLOY6VVxqzBtZ9nFKOlgHVYketTmXbM0T3vT553r7Qlqsg6vVQvRhUWKWBScZP4Nuhl3n6I8U= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:DM3PR07MB2252; BCL:0; PCL:0; RULEID:; SRVR:DM3PR07MB2252; X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2252; 4:2ZIB8XmobxhOTkvV32c6AMuGHZWoTt9CcF/95lR23mlUn+rOTW5Daiu4NYutU3NbF3mwUIPNPlWYSsY1ioYv02wOUotB5shB40zdlR6jlQStMUN6i7ZfMSFXt8inmgEo7Q+qOi2fzoCUS4accgMBEaPp8bpaBXtuF31S+TxbhnxTKYUtZiPG3R+rm7i2JclAUOiLcEC9c5c7DgvW/f6RjACNPuPR0tpDSO65CPTwRo3g3V05uEFRwG/tE/1X7kDQK7LWbrrE+GvwvO8mRr49Tvwg+FAAyRr+QVJt4sok/N4GqZ4S61Lk89uZklYjduy+joqyCRKSMll368JmhqfV11pxcAyVrinjUKz69s5cJjhjKcf0+Iwql51lt+KAfXX9 X-Forefront-PRVS: 0983EAD6B2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(199003)(189002)(5003940100001)(50986999)(97736004)(4001430100002)(5001770100001)(3846002)(6116002)(189998001)(586003)(7846002)(81156014)(7736002)(92566002)(68736007)(81166006)(305945005)(50226002)(77096005)(19580405001)(19580395003)(2906002)(76506005)(229853001)(33646002)(575784001)(47776003)(105586002)(106356001)(42186005)(8676002)(66066001)(50466002)(48376002)(107886002)(101416001)(36756003)(4326007)(2201001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR07MB2252; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2252; 23:zlZj/Sv8uWgfgmZh6W2Uwjgv886q2FUQvO5dRn8Tm1FKRnkuRbMuUuvCQUu9mGVgUMFVoqjSJ24l8Qlvbtyju/zu5MwyqgmuNL1o8+K9ZRvWdYPAjM8svZDLl6qePbm+4snI5vWJlhAYqWSjUoBAJpXGCl8giW7dFJPausXjkL6LQuj2o/s2RawpngppZUAFMmSucA6uFzCm7NT0djuvplNcbihzjSA5oWySksi4AGqqXhAX53YVEgYpFjGvxY3fCWIOmR0bJ9NwtVvB8f5rNuw9avpyJzb0iH+XGUa2/9h0EfaSXiTVXHK2FShYyT1IdfJRVFXDlYVXZBK0dSxxbGvbDp5I4cHjfPPbCWDmdlHhZ/pwIz/9GWIFCGyQDZRBp1nNLYNZTWXb0L+Z8PGVtV4GoBzKL1NCfMSV4ykOgN/OPf9kQCpOoZKAmRLcBRYYwp2cVgSWujWla6Ar8xUQOG69j4+b35aCYIlIMhxd+xmZX3xdbzl1mbSR/nGAgCyL+Gu1nCslETl1H6/x39WL3MyXiVejB3U3gxAK+MPu4dQNhUNnBQDMlceS1iF6PfkRmt3cJDugNRPj2JOR4rb9k+giAO6O/VyyzAhk8kra7ExChCKJa+CCIMFUrevWAv4anjMttPVCajluPqLS6QkcyNVJHwTPCF3tzqcqdfDx9xESpkVPHQX3otPKqpigL1jgZcPbG2R4wGbK2TpGH1nJKcR/VKBtUx7WbPb8aPHiaKLz85piEZ0g4DKyQqGUDqGbANZDRwFMPQ4s2D4tRdCLPcxIcNrVAhCDzqrWXeWZwN7dofmrx2GnKjifi0h01TkKNN0wnXrO7gw1nF0ZTgaqpRsD1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xk6HaDzBpd6cLgRWpsCV74f0FSVlqFLzzIEITeCHRQxRa2+XlD4FOO3LpL3d/RkApA+P8uDcPoh3+fIJK3TNKNG2EQm+4Vf6KjG3E42jgxAowbT5Y+IuiExqg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2016 12:23:14.7387 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR07MB2252 There are 3 syscall wrappers under sysdeps/unix/sysv/linux that calculate register pair for off_t like this: __LONG_LONG_PAIR (offset >> 31, offset) While it works for 32-bit off_t, new 32-bit APIs that use 64-bit off_t will be broken with it. This patch redirects affected syscalls to their 64-bit versions. It also saves few instructions and symbols in glibc, as 32-bit syscall wrappers are not generated anymore. Tested on AARCH64/ILP32. Signed-off-by: Yury Norov --- sysdeps/unix/sysv/linux/fallocate.c | 4 ++++ sysdeps/unix/sysv/linux/fallocate64.c | 4 ++++ sysdeps/unix/sysv/linux/posix_fadvise.c | 4 ++++ sysdeps/unix/sysv/linux/posix_fadvise64.c | 4 ++++ sysdeps/unix/sysv/linux/posix_fallocate.c | 4 ++++ sysdeps/unix/sysv/linux/posix_fallocate64.c | 4 ++++ 6 files changed, 24 insertions(+) -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/fallocate.c b/sysdeps/unix/sysv/linux/fallocate.c index 6a58a5f..4ec55a5 100644 --- a/sysdeps/unix/sysv/linux/fallocate.c +++ b/sysdeps/unix/sysv/linux/fallocate.c @@ -20,6 +20,8 @@ #include +#ifndef __OFF_T_MATCHES_OFF64_T + /* Reserve storage for the data of the file associated with FD. */ int fallocate (int fd, int mode, __off_t offset, __off_t len) @@ -33,3 +35,5 @@ fallocate (int fd, int mode, __off_t offset, __off_t len) return -1; #endif } + +#endif /* __OFF_T_MATCHES_OFF64_T */ diff --git a/sysdeps/unix/sysv/linux/fallocate64.c b/sysdeps/unix/sysv/linux/fallocate64.c index 8e76d6f..f4f73d5 100644 --- a/sysdeps/unix/sysv/linux/fallocate64.c +++ b/sysdeps/unix/sysv/linux/fallocate64.c @@ -35,3 +35,7 @@ fallocate64 (int fd, int mode, __off64_t offset, __off64_t len) return -1; #endif } + +#ifdef __OFF_T_MATCHES_OFF64_T +weak_alias(fallocate64, fallocate) +#endif diff --git a/sysdeps/unix/sysv/linux/posix_fadvise.c b/sysdeps/unix/sysv/linux/posix_fadvise.c index 093d707..8356bc7 100644 --- a/sysdeps/unix/sysv/linux/posix_fadvise.c +++ b/sysdeps/unix/sysv/linux/posix_fadvise.c @@ -19,6 +19,8 @@ #include #include +#ifndef __OFF_T_MATCHES_OFF64_T + /* Advice the system about the expected behaviour of the application with respect to the file associated with FD. */ @@ -46,3 +48,5 @@ posix_fadvise (int fd, off_t offset, off_t len, int advise) return ENOSYS; #endif } + +#endif /* __OFF_T_MATCHES_OFF64_T */ diff --git a/sysdeps/unix/sysv/linux/posix_fadvise64.c b/sysdeps/unix/sysv/linux/posix_fadvise64.c index 6d10558..c76d52f 100644 --- a/sysdeps/unix/sysv/linux/posix_fadvise64.c +++ b/sysdeps/unix/sysv/linux/posix_fadvise64.c @@ -56,3 +56,7 @@ compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2); #else strong_alias (__posix_fadvise64_l64, posix_fadvise64); #endif + +#ifdef __OFF_T_MATCHES_OFF64_T +weak_alias(__posix_fadvise64_l64, __posix_fadvise) +#endif /* __OFF_T_MATCHES_OFF64_T */ diff --git a/sysdeps/unix/sysv/linux/posix_fallocate.c b/sysdeps/unix/sysv/linux/posix_fallocate.c index fc9ac37..f9ca34b 100644 --- a/sysdeps/unix/sysv/linux/posix_fallocate.c +++ b/sysdeps/unix/sysv/linux/posix_fallocate.c @@ -18,6 +18,8 @@ #include #include +#ifndef __OFF_T_MATCHES_OFF64_T + #define posix_fallocate static internal_fallocate #include #undef posix_fallocate @@ -37,3 +39,5 @@ posix_fallocate (int fd, __off_t offset, __off_t len) return INTERNAL_SYSCALL_ERRNO (res, err); return internal_fallocate (fd, offset, len); } + +#endif /* __OFF_T_MATCHES_OFF64_T */ diff --git a/sysdeps/unix/sysv/linux/posix_fallocate64.c b/sysdeps/unix/sysv/linux/posix_fallocate64.c index 4a0a722..3a65d35 100644 --- a/sysdeps/unix/sysv/linux/posix_fallocate64.c +++ b/sysdeps/unix/sysv/linux/posix_fallocate64.c @@ -40,3 +40,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len) return INTERNAL_SYSCALL_ERRNO (res, err); return internal_fallocate64 (fd, offset, len); } + +#ifdef __OFF_T_MATCHES_OFF64_T +weak_alias(__posix_fallocate64_l64, posix_fallocate) +#endif