From patchwork Thu Feb 1 20:46:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 25745 Received: (qmail 12422 invoked by alias); 1 Feb 2018 20:46:13 -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 12388 invoked by uid 89); 1 Feb 2018 20:46:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Date: Thu, 1 Feb 2018 20:46:05 +0000 From: Joseph Myers To: Subject: Do not use packed structures in soft-fp [committed] Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) Building for soft-float ColdFire produces an error in soft-fp: In file included from ../sysdeps/ieee754/soft-fp/s_fmaf.c:42: ../soft-fp/single.h:85:3: error: 'packed' attribute ignored for field of type 'struct ' [-Werror=attributes] } bits __attribute__ ((packed)); ^ While this error only appears in that particular case, this attribute is in fact never useful, on any architecture. If you have struct __attribute__ ((packed)) { ... } bits; or struct { ... } __attribute__ ((packed)) bits; then the attribute affects the layout of the structure type. But with the form used in this code struct { ... } bits __attribute__ ((packed)); the field bits is being declared packed, but the layout of its type has already been determined at that point. If on any platform the layout of the sequence of bit-fields were wrong without the use of a packed attribute, the attribute would need to be used via a definition of _FP_STRUCT_LAYOUT, not in its present position. So this patch removes the useless attribute to fix the build for ColdFire soft-float. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. Committed. 2018-02-01 Joseph Myers * soft-fp/double.h (union _FP_UNION_D): Do not use attribute packed on bits. * soft-fp/extended.h (union _FP_UNION_E): Likewise. * soft-fp/half.h (union _FP_UNION_H): Likewise. * soft-fp/quad.h (union _FP_UNION_Q): Likewise. * soft-fp/single.h (union _FP_UNION_S): Likewise. diff --git a/soft-fp/double.h b/soft-fp/double.h index f6c83d7..23d11cc 100644 --- a/soft-fp/double.h +++ b/soft-fp/double.h @@ -89,7 +89,7 @@ union _FP_UNION_D unsigned exp : _FP_EXPBITS_D; unsigned sign : 1; # endif - } bits __attribute__ ((packed)); + } bits; }; # define FP_DECL_D(X) _FP_DECL (2, X) @@ -210,7 +210,7 @@ union _FP_UNION_D unsigned exp : _FP_EXPBITS_D; unsigned sign : 1; # endif - } bits __attribute__ ((packed)); + } bits; }; # define FP_DECL_D(X) _FP_DECL (1, X) diff --git a/soft-fp/extended.h b/soft-fp/extended.h index 102acfc..d279432 100644 --- a/soft-fp/extended.h +++ b/soft-fp/extended.h @@ -88,7 +88,7 @@ union _FP_UNION_E unsigned exp : _FP_EXPBITS_E; unsigned sign : 1; # endif /* not bigendian */ - } bits __attribute__ ((packed)); + } bits; }; diff --git a/soft-fp/half.h b/soft-fp/half.h index ea28db6..a1fea7b 100644 --- a/soft-fp/half.h +++ b/soft-fp/half.h @@ -75,7 +75,7 @@ union _FP_UNION_H unsigned exp : _FP_EXPBITS_H; unsigned sign : 1; #endif - } bits __attribute__ ((packed)); + } bits; }; #define FP_DECL_H(X) _FP_DECL (1, X) diff --git a/soft-fp/quad.h b/soft-fp/quad.h index 71621f0..9a9e4e7 100644 --- a/soft-fp/quad.h +++ b/soft-fp/quad.h @@ -93,7 +93,7 @@ union _FP_UNION_Q unsigned exp : _FP_EXPBITS_Q; unsigned sign : 1; # endif /* not bigendian */ - } bits __attribute__ ((packed)); + } bits; }; diff --git a/soft-fp/single.h b/soft-fp/single.h index 2918f78..d5c4a6d 100644 --- a/soft-fp/single.h +++ b/soft-fp/single.h @@ -82,7 +82,7 @@ union _FP_UNION_S unsigned exp : _FP_EXPBITS_S; unsigned sign : 1; #endif - } bits __attribute__ ((packed)); + } bits; }; #define FP_DECL_S(X) _FP_DECL (1, X)