From patchwork Wed Nov 23 18:21:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 83737 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp2783166qge; Wed, 23 Nov 2016 10:22:01 -0800 (PST) X-Received: by 10.84.204.133 with SMTP id b5mr9336085ple.49.1479925321925; Wed, 23 Nov 2016 10:22:01 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 1si6388908pll.139.2016.11.23.10.22.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Nov 2016 10:22:01 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-75097-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-75097-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-75097-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:message-id:subject:from:to:cc:date :content-type:mime-version; q=dns; s=default; b=wnlIEqMXuH2d3Tkq sccKHVzCjQmvVjdBNQqbi8HH8BZYsEZ3QAZRbLAUD6r0mxyuwbk4IsHYFrrltqpQ OLidFNTjQ7C0RICnFeuFLm9fihO7aRhkLb7VFuTo2VozRLuIdv7kaW3j7tCfPlXw M6UQhb4dgDUavkCs3K5tj0mE5eg= 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:message-id:subject:from:to:cc:date :content-type:mime-version; s=default; bh=HvdlbUONyRt/0NHyjLb9dn lOibM=; b=VQZWkCNAndZJijpyRBQVv6TVH4P+WNyF003hr0lOM1AJ3YihfnftxV wGMJNMZkjOUbnn7ddf5ZzLg7oFpw8qOUvQHU0o0K5Q1o9Pw2FTUNg+XtfY6EUjHJ zpiEefnvXsoqiyaofYgoWitjylQEH7DeRkzwyyGdjYo4kLLVR/uNM= Received: (qmail 101524 invoked by alias); 23 Nov 2016 18:21:50 -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 101499 invoked by uid 89); 23 Nov 2016 18:21:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:3897 X-HELO: NAM03-BY2-obe.outbound.protection.outlook.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Steve.Ellcey@cavium.com; Message-ID: <1479925292.14643.34.camel@caviumnetworks.com> Subject: [PATCH] Fix for [f]statfs64/[f]statfs aliasing patch From: Steve Ellcey To: CC: Joseph Myers , Andreas Schwab Date: Wed, 23 Nov 2016 10:21:32 -0800 MIME-Version: 1.0 X-ClientProxiedBy: BN3PR11CA0030.namprd11.prod.outlook.com (10.162.169.40) To DM2PR0701MB1065.namprd07.prod.outlook.com (10.160.26.18) X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1065; 2:geKldt3DYenWokPWOOpbWug9wCH5W4WH59yNfvNGl8O1m1zZzPmjP6QO8AqIB1coIAK8u0slgvMmNCNHnIkC9wwJMy6tElLnuqlqn1JVabNwsBNmeSxF9t9A384mhNy5zVuGYsvoWN9azL4neKu0H3j2j5cdWGwr13fBpXW9Jjk=; 3:wkMRK0qkMz8OamE9RlblxoR1br72FGG0lOGT6znlyi/e4iK/MiMDvfSe3k4dlMqd4QIXlI/+NxWR/Tou+v+S5oIMhFr4zylkRm9OrVoQ4qEPwWy/a4wMnIuSDeAqqbQXLUUSQS7N1Utk/SPEnutQJIjhPLam9Q7zyYZrIyl8FjU=; 25:XCrwHHmKceQGT2mymkmB7GdpkX0a6LbMBMxVihQsz2p8eoCD7Q94jFSov0VlYcv81Mt2474pXFUgX2ETne7eBLhO7IDvK2yv+n2j43q1ysxm3Bg9Fo1UMrQorvcG5o2ebPDeQU1wEUVLrP37D92oACYEb+Cr3iyP2e/4VsNUT+azYwky9gkPvIHCGaiqFCH8l8OXn3+J9oZas6Ao2JZe1S10H33X+44Pw17CF8V4tRL7Tux3v6WSj+m2iZ4MsDhXOPmVZbuA4zTroxKD2XKn9Bcncmx7asGFyjdtuDOz1J7Uw8AHTclqMsfxd/Da53dnCIQPAY+yTXjbu0zI0srAQkyvXDpURyiTxa/wle3w2Ym5EBJSskid7997zFBQ09KfAaxqgGEuayR6o4dtudDK4QOPtKquGLBuIUFhatlRi+zjLqk+RrOqyWcIRDEzejLu1BtiuJCW+Bo5fSeJfc2Apg68ejIeLbVNSsQ9P05bFkUfOk0rMQOkUDl+Ae11pYxxERFWxNN83J9UcoQD7IGMXQ== X-MS-Office365-Filtering-Correlation-Id: 48d3498f-c3c1-4cb6-3939-08d413cd9014 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM2PR0701MB1065; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1065; 31:fLN67ue1Pa9hwF5WvVdCRPoVWJgsbhSmvhZDeTiaGDdUfqnsb8EfkBEJpOi94CyfRdbqFcQbIjf7r2sY5mFBoiBydcSUxoxvi7VAu/im/nLdFerudxWN9V/0OOIBsVLSRHAREe3vXO45VchcMj3t286n2d8NkyNfu6DSz3B1d8DYc6WlE71aWMIx6QM/rMoA14mwIHSTBywG2yhDKHkfmT08ZZafpM5lXVkI1SMvUyhjNNWVkTHpCEBi49S4hzRcbTzkKnG7kpF5djTzC6CYzdEzNoL7GlVOzvKuVfcXwSU=; 20:veHPLgK22sHDZ1APZz6Tdho6xoLIfVSStJ1VHp13ayGLCNm7D/yoUHMNvDK7ACcEQeC5vRH3BNcradfy7mE3zCpiUVxVOdiahyhWq5O9GPxi86rxEmnxVYUBftKGWsF0TN+jzcw3ZWSRxuB8lqSSV9KuQXEPryGB5c9WwA5qE/knOhMhtOZ/5CPvKmLF9rcui8pxKbM3KtrlT0yKym+j029GsbwBsXaFMGR4NidPqbNSjpAhqA2vBneHSJdIlZyXlswVHbdMb2OssYDlRaWSOxHnxfJxbpeUk//FaXzWwS5wiFIH60ghgwTd/J4vn+Ns4KKd0vq7vIImehrbe72/cs0yVpxMNwV2/AZEW9kTFSibXep8rKV/UzYOgFpM9vUzAE0kkSKCSBdu5hNOJyp7NMYvv/qpP5zCAT6TZx0fARVjnnjZyvOOWETo8I/o/Bv3zt6OUGMsNBqxxj/J55jGKH1ex/0+pmj7u3pyzd2giC3XEV/zK27m8eXio/AtH1uMvyB8qNRVkuZcf8t8ViacsPi6nEmuLTJmeGBQ9eB1aGfpbjNZOXD/a3qJRkOsEctTyLPn+2TEaWxBSDXKr4M/PcQXYUEunLd9e+l+85dNV+E= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(102415395)(6045199)(6040307)(6060326)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6061324)(6041248); SRVR:DM2PR0701MB1065; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0701MB1065; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1065; 4:2KFcVKDy7263R2hLTRyXi9iq9Ey0cISA/SAQ4pfHSMa6L+kY1Ocu9vle+PNkb4dMjLykMizxD1GhNRKKg2/sxQa1GpiS3fKSi3cy7BH7+BBQ5tGIpl9ZmFoN12xpYTAYIK7ac+vXCOYzYAl71W5YQTius3HF9lKnHpQvh+x9d298Er02O7QrnvcNEKZjmz2WY9TQR3qAHbYnqZlByV+7BRP5wopmByHZG/3gVv9GbhJdpP/D7eGdnAvAuckojmCiKBJsUBI6vYKXlee+pu36hB+yRP9N1msglkBfGgS7j/idT0wlMiykPmaeGLxceAT37Bac0nhSwpFB7i90JtrCIEyPBbNJ9K9IcCssyjFS5egAzIGv/2kw1gaFfiu8rhPUNIlfHZRup9SwWM+lzDNdxAfxxE4TA8oq23pjNl+Dlgp8zJYXt4wQ9GqsRotJN/EegDQcmLnqdPpUaZycCEgitNaMH0fkDaUKMxqnkupIV71amsNCREeJgkOOLLr2mxxz X-Forefront-PRVS: 013568035E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(377424004)(189002)(199003)(66066001)(68736007)(6916009)(7736002)(305945005)(7846002)(4001150100001)(2351001)(512874002)(84326002)(4326007)(50226002)(8676002)(81166006)(6666003)(42882006)(38730400001)(2906002)(110136003)(81156014)(189998001)(50986999)(92566002)(6116002)(77096005)(101416001)(568964002)(97736004)(69596002)(2476003)(103116003)(53416004)(5890100001)(4610100001)(36756003)(42186005)(5660300001)(3846002)(33646002)(106356001)(105586002)(99106002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0701MB1065; H:sellcey-lt.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0701MB1065; 23:NBIbEnFAAu4Zxxb2i2bIrSkmdXRGDuckVcaVT2X?= =?us-ascii?Q?Exxeu3k6PEzqVChfjIHLTmaxhKue5u9eJ2Pzx6AVYb55fnfLClew/fpr+4I6?= =?us-ascii?Q?pjDOBZMepwnCuBts/yvpzKLYyL9v1nB5V4dOjCjLmjgBmOISN7R5FCPhZkSK?= =?us-ascii?Q?bd8dl5E3MQrU5Z8DpkcHsjzbD9maveLuIDXs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AZWtimc9gHg2CpErUtTit/nbIQ5Oe76v+311WQgigiPYeNk?= =?us-ascii?Q?57JorWI3XUAJpWOemfBKLxl2M8bT+0Jup2M+bmycY3vZspXmX0EDEOGcBf6b?= =?us-ascii?Q?EEvLwvBw0EGjii0kl1fAEwHxA7yOW1qTU1TD0?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1065; 6:dG1XvxQ7VN2sA5bL/O7J94LpzNFZg2RFc2r/tQujK/moX1lJ85++pDxpLOpeMnlMW9VrUnmmTrqc3hFFA+y7fudNuf5ldnbdVJ0vHKffrDurhXn1NtHqwajqvne9x3RoGbCL/vEgp3ryL1MGn88WnNQsg8FqCoif3UZXMOOHBuGzV5IpSCFAD+/QUt8BTQ/llzgRR7zFH2DiX5RgeFB26vu+RdO7w6wehZpQZAPAKdG7kaQXIm3yR2O6qW9Khwlzvnptpw320hSKnhHkl+G5aAg96vgEhx+zJJAMZf/NyIgt9YsUeWwrfEMPyRXvUIM+8iAXjeFwTqSKHVHQkjxr5TW07V2NOcOH3QidTSZFn8g=; 5:hQL2MHTsf85uheYB7M189LwYqIzokoUs6EiiQBLOv781g0b3N/Ivc6xpcVt7M/K+G1+99OgUoA/dPQw6ifv+vTTOW7OjgqVa33EYVpJLL3yxfB5OpVcrnno5RB/YdAYbfND2221OgMYrEGEnOIlk6HxVf9R4cslPJ7PPowTafJ4=; 24:NZMZPOtT9cD3JxtwNOZpo+yTZ31t7o8d0oVBFoGJJCv00tEAhikExUwvBD1dPZ+O+ac6f1Ru9bDuCVwEyVtDRr6gSly9+y6ACSmt3W20Z/s= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1065; 7:/KpHWB+ybNFLXFWY3IySHzeuHV7bvZeyQGqIhoc3R0XE5TJN4C15kXR3KNoaaFLwh8SydW55kTeQ2S70R/gnAX3A6HVYEPYIr4dQuIPRTQZZgOUaG1EgoJ+Vw+kkaFCBLkeT2g6af3MfO3oxn2WAJZlTvZBnveCUkT/tEjY0ugooygEfVfxhEyp5L9n0pyybOdBuHu5KdRKpZm+XYlJH5nndp4pSzBQkhPCWTtrAmcD/i4d5Q8i+GhH0dlMWtV5H0rVsCfQMxJ3++cbXCU1QKcA2e9cwEvDgPuxDoqhM+/UXKjPiOi67gwW9qqTR24MprX4ItsOt2ujU8jk6ewiZ++c8CbN4lb+p7ZR4WBPXkZo= X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2016 18:21:36.6465 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0701MB1065 This patch is a fix to my earlier statfs patch  (https://sourceware.org/ml/libc-alpha/2016-11/msg00360.html) that allowed statfs/fstatfs to be aliases of statfs64/fstatfs64 but broke the alpha build.  When doing this aliasing it is necessary that the prototypes of [f]statfs not be seen because they differ from that of [f]statfs64.  They have the same structures but different names, so GCC will complain when doing the aliasing. My initial patch used a #define to hide the prototypes of [f]statfs and __[f]statfs when defining [f]statfs64 but I hadn't noticed that when __ASSUME_STATFS64 is 0, the [f]statfs64 function calls __[f]statfs and if we have changed the name of this with a define then [f]statfs64 will call the wrong (and undefined) function.  This only happens on alpha which is the only platform where __ASSUME_STATFS64 is 0. This patch fixes the problem by only hiding the [f]statfs definitions if STATFS_IS_STATFS64 is set to non-zero, which is also the only time we do the aliasing.  To do this I had to change the order of the includes because we cannot check STATFS_IS_STATFS64 until after we have included kernel_stat.h but we must do it before including sys/stat.h which is where the [f]statfs prototypes are defined. I have tested this and verified that it builds for alpha (using the build-many-glibcs.py script) and also verified it builds and has no testsuite regressions on x86 and aarch64. OK to checkin? Steve Ellcey sellcey@caviumnetworks.com 2016-11-23  Steve Ellcey   * sysdeps/unix/sysv/linux/fstatfs64.c: Reorder include files, only alias fstatfs and __fstatfs if STATFS_IS_STATFS64 is non-zero. * sysdeps/unix/sysv/linux/statfs64.c: Ditto for statfs and __statfs. diff --git a/sysdeps/unix/sysv/linux/fstatfs64.c b/sysdeps/unix/sysv/linux/fstatfs64.c index a95fe18..42b2257 100644 --- a/sysdeps/unix/sysv/linux/fstatfs64.c +++ b/sysdeps/unix/sysv/linux/fstatfs64.c @@ -16,20 +16,23 @@ License along with the GNU C Library; if not, see . */ +#include +#include +#include +#include +#include + /* Hide the prototypes for __fstatfs and fstatfs so that GCC will not complain about the different function signatures if they are aliased to __fstat64. If STATFS_IS_STATFS64 is not zero then the statfs and statfs64 structures have an identical layout but different type names. */ -#define __fstatfs __fstatfs_disable -#define fstatfs fstatfs_disable - -#include -#include +#if STATFS_IS_STATFS64 +# define __fstatfs __fstatfs_disable +# define fstatfs fstatfs_disable +#endif #include -#include -#include -#include + #include /* Defined in statfs64.c. */ diff --git a/sysdeps/unix/sysv/linux/statfs64.c b/sysdeps/unix/sysv/linux/statfs64.c index 4315fe5..9dbd61f 100644 --- a/sysdeps/unix/sysv/linux/statfs64.c +++ b/sysdeps/unix/sysv/linux/statfs64.c @@ -16,20 +16,23 @@ License along with the GNU C Library; if not, see . */ +#include +#include +#include +#include +#include + /* Hide the prototypes for __statfs and statfs so that GCC will not complain about the different function signatures if they are aliased to __stat64. If STATFS_IS_STATFS64 is not zero then the statfs and statfs64 structures have an identical layout but different type names. */ -#define __statfs __statfs_disable -#define statfs statfs_disable - -#include -#include +#if STATFS_IS_STATFS64 +# define __statfs __statfs_disable +# define statfs statfs_disable +#endif #include -#include -#include -#include + #include