This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [patch libgcc]: Fix float128 soft-float for mingw targets
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: libc-alpha at sources dot redhat dot com, GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Henderson <rth at redhat dot com>
- Date: Mon, 27 Feb 2012 18:20:26 +0100
- Subject: Re: [patch libgcc]: Fix float128 soft-float for mingw targets
- Authentication-results: mr.google.com; spf=pass (google.com: domain of ktietz70@googlemail.com designates 10.60.4.106 as permitted sender) smtp.mail=ktietz70@googlemail.com; dkim=pass header.i=ktietz70@googlemail.com
- References: <CAEwic4aZE8WXvs0TwAWr-1GZn6JNzi7_WJ50vBcm45HpdPVGdw@mail.gmail.com><Pine.LNX.4.64.1202271539400.15223@digraph.polyomino.org.uk><CAEwic4bO7MbWoGcjG-a2jJw6m7v_YrGpy98yYcn3wyo3r7g8ww@mail.gmail.com><Pine.LNX.4.64.1202271649220.15223@digraph.polyomino.org.uk>
2012/2/27 Joseph S. Myers <joseph@codesourcery.com>:
> On Mon, 27 Feb 2012, Kai Tietz wrote:
>
>> For gcc_struct variant bitfields with different types get merged
>> together, but for ms_struct ?bitfields are getting merged together
>> only, if they have same type. ?As in those structures - I modified in
>> this patch - we have varying types for bitfields, this struct-layout
>> attribute is required.
>
> I think you need a comment in soft-fp.h explaining the issue (and in
> particular that it is about structures with consecutive (?) bit-fields
> with different declared types). ?Though I presume the attribute is
> harmless on other structures - so it might make sense to put it in
> single.h and double.h as well to make it clear that those structures too
> are expected to follow the same layout rules as those in extended.h and
> quad.h.
Ok. Done. Here is the patch for glibc only
ChangeLog glibc
2012-02-28 Kai Tietz <ktietz@redhat.com>
* soft-fp/soft-fp.h (_FP_STRUCT_LAYOUT): If not defined,
define it as empty macro.
* soft-fp/quad.h: Mark bitfield-structures by _FP_STRUCT_LAYOUT.
* soft-fp/extended.h: Likewise.
* soft-fp/single.h: Likewise.
* soft-fp/double.h: Likewise.
Ok for apply?
Regards,
Kai
Index: soft-fp/extended.h
===================================================================
--- soft-fp/extended.h (revision 184486)
+++ soft-fp/extended.h (working copy)
@@ -64,7 +64,7 @@
union _FP_UNION_E
{
XFtype flt;
- struct
+ struct _FP_STRUCT_LAYOUT
{
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned long pad1 : _FP_W_TYPE_SIZE;
@@ -263,7 +263,7 @@
union _FP_UNION_E
{
XFtype flt;
- struct {
+ struct _FP_STRUCT_LAYOUT {
#if __BYTE_ORDER == __BIG_ENDIAN
_FP_W_TYPE pad : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
unsigned sign : 1;
Index: soft-fp/single.h
===================================================================
--- soft-fp/single.h (revision 184486)
+++ soft-fp/single.h (working copy)
@@ -58,7 +58,7 @@
union _FP_UNION_S
{
SFtype flt;
- struct {
+ struct _FP_STRUCT_LAYOUT {
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned sign : 1;
unsigned exp : _FP_EXPBITS_S;
Index: soft-fp/double.h
===================================================================
--- soft-fp/double.h (revision 184486)
+++ soft-fp/double.h (working copy)
@@ -68,7 +68,7 @@
union _FP_UNION_D
{
DFtype flt;
- struct {
+ struct _FP_STRUCT_LAYOUT {
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned sign : 1;
unsigned exp : _FP_EXPBITS_D;
@@ -167,7 +167,7 @@
union _FP_UNION_D
{
DFtype flt;
- struct {
+ struct _FP_STRUCT_LAYOUT {
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned sign : 1;
unsigned exp : _FP_EXPBITS_D;
Index: soft-fp/quad.h
===================================================================
--- soft-fp/quad.h (revision 184486)
+++ soft-fp/quad.h (working copy)
@@ -67,7 +67,7 @@
union _FP_UNION_Q
{
TFtype flt;
- struct
+ struct _FP_STRUCT_LAYOUT
{
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned sign : 1;
@@ -171,10 +171,11 @@
union _FP_UNION_Q
{
TFtype flt /* __attribute__((mode(TF))) */ ;
- struct {
+ struct _FP_STRUCT_LAYOUT {
_FP_W_TYPE a, b;
} longs;
- struct {
+ struct _FP_STRUCT_LAYOUT
+ {
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned sign : 1;
unsigned exp : _FP_EXPBITS_Q;
Index: soft-fp/soft-fp.h
===================================================================
--- soft-fp/soft-fp.h (revision 184486)
+++ soft-fp/soft-fp.h (working copy)
@@ -85,6 +85,14 @@
#define FP_EX_DENORM 0
#endif
+/* For native windows targets struct-layout follows the ms-bitfields
+ layout. For unix-targets instead the gcc-struct-layout is used.
+ The difference between ms/gcc struct-layout is in consecutive bit-fields
+ with different declared types, which are getting packed different. */
+#ifndef _FP_STRUCT_LAYOUT
+#define _FP_STRUCT_LAYOUT
+#endif
+
#ifdef _FP_DECL_EX
#define FP_DECL_EX \
int _fex = 0; \