]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Do not use packed structures in soft-fp.
authorJoseph Myers <joseph@codesourcery.com>
Thu, 1 Feb 2018 20:44:49 +0000 (20:44 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 1 Feb 2018 20:44:49 +0000 (20:44 +0000)
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 <anonymous>' [-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.

* 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.

ChangeLog
soft-fp/double.h
soft-fp/extended.h
soft-fp/half.h
soft-fp/quad.h
soft-fp/single.h

index 7923327a9d22513b5630e04ade5e164474d1033a..2d9734a688f0ac399371144341e2e1685312c2d6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2018-02-01  Joseph Myers  <joseph@codesourcery.com>
+
+       * 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.
+
 2018-02-01  Carlos O'Donell  <carlos@redhat.com>
            Ramin Seyed-Moussavi  <lordrasmus@gmail.com>
            Joseph Myers  <joseph@codesourcery.com>
index f6c83d72534ca76d3c67d00cf019e854f8f2c807..23d11ccf7269669cc78966f6fd4cc6d362c4804a 100644 (file)
@@ -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)
index 102acfc1ca050c941019aa091d63651f9d6a8d00..d2794320fa1163bc733182f07c0fdc1fdd808c1c 100644 (file)
@@ -88,7 +88,7 @@ union _FP_UNION_E
     unsigned exp : _FP_EXPBITS_E;
     unsigned sign : 1;
 # endif /* not bigendian */
-  } bits __attribute__ ((packed));
+  } bits;
 };
 
 
index ea28db6c18e78c168229b0f04410c3fc2be218ec..a1fea7b0075e6c12f5932f7b522ae9d34455f9c2 100644 (file)
@@ -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)
index 71621f01bfe9ef7e25718ef52f2aa9b9cafaa5a7..9a9e4e71f7371b17c78cf35cc144e8065c02da92 100644 (file)
@@ -93,7 +93,7 @@ union _FP_UNION_Q
     unsigned exp : _FP_EXPBITS_Q;
     unsigned sign : 1;
 # endif /* not bigendian */
-  } bits __attribute__ ((packed));
+  } bits;
 };
 
 
index 2918f78d9712185eb7f82cc567573d6f3cbd1748..d5c4a6d4a1e1811840dcbf55e029080138beb86c 100644 (file)
@@ -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)