about summary refs log tree commit diff
path: root/soft-fp/double.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2018-02-01 20:44:49 +0000
committerJoseph Myers <joseph@codesourcery.com>2018-02-01 20:44:49 +0000
commit049375e2b5fc707436fd5d80337c253beededb2d (patch)
tree235887c0c0dbe975f92f73a082c92c219b76dd7b /soft-fp/double.h
parentf1d7368196e27370dcb5dfa3319e102f33b9ad66 (diff)
downloadglibc-049375e2b5fc707436fd5d80337c253beededb2d.tar.gz
glibc-049375e2b5fc707436fd5d80337c253beededb2d.tar.xz
glibc-049375e2b5fc707436fd5d80337c253beededb2d.zip
Do not use packed structures in soft-fp.
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.
Diffstat (limited to 'soft-fp/double.h')
-rw-r--r--soft-fp/double.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/soft-fp/double.h b/soft-fp/double.h
index f6c83d7253..23d11ccf72 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)