Linux PARISC architecture development
 help / color / mirror / Atom feed
* [parisc-linux] gcc-3.[02] alignment problem
@ 2002-07-16  5:00 Randolph Chung
  2002-07-16  5:01 ` [parisc-linux] " Randolph Chung
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Randolph Chung @ 2002-07-16  5:00 UTC (permalink / raw)
  To: parisc-linux; +Cc: gcc

Compiling the linux kernel (2.4.19-rc1-ac5) with hppa64-linux-gcc 
(3.0.4 or 3.2) gives:

tausq@a500:~/src/linux-2.4.19-rc1/net/ipv4$ hppa64-linux-gcc -D__KERNEL__ -I/home/tausq/src/linux-2.4.19-rc1/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -D__linux__ -pipe -fno-strength-reduce -mno-space-regs -mfast-indirect-calls -mdisable-fpregs -ffunction-sections -march=2.0 -mschedule=8000   -nostdinc -I /usr/lib/gcc-lib/hppa64-linux/3.0/include -DKBUILD_BASENAME=tcp_diag  -c -o tcp_diag.o tcp_diag.c
{standard input}: Assembler messages:
{standard input}:138: Error: Field not properly aligned [8] (44).
{standard input}:138: Error: Invalid operands
{standard input}:609: Error: Field not properly aligned [8] (44).
{standard input}:609: Error: Invalid operands
{standard input}:707: Error: Field not properly aligned [8] (44).
{standard input}:707: Error: Invalid operands

preprocessed source attached.

(incidentally, we also see this while building glibc...)

randolph
--  
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [parisc-linux] gcc-3.[02] alignment problem
@ 2002-07-16  5:00 Randolph Chung
  0 siblings, 0 replies; 20+ messages in thread
From: Randolph Chung @ 2002-07-16  5:00 UTC (permalink / raw)
  To: parisc-linux; +Cc: gcc

Compiling the linux kernel (2.4.19-rc1-ac5) with hppa64-linux-gcc 
(3.0.4 or 3.2) gives:

tausq@a500:~/src/linux-2.4.19-rc1/net/ipv4$ hppa64-linux-gcc -D__KERNEL__ -I/home/tausq/src/linux-2.4.19-rc1/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -D__linux__ -pipe -fno-strength-reduce -mno-space-regs -mfast-indirect-calls -mdisable-fpregs -ffunction-sections -march=2.0 -mschedule=8000   -nostdinc -I /usr/lib/gcc-lib/hppa64-linux/3.0/include -DKBUILD_BASENAME=tcp_diag  -c -o tcp_diag.o tcp_diag.c
{standard input}: Assembler messages:
{standard input}:138: Error: Field not properly aligned [8] (44).
{standard input}:138: Error: Invalid operands
{standard input}:609: Error: Field not properly aligned [8] (44).
{standard input}:609: Error: Invalid operands
{standard input}:707: Error: Field not properly aligned [8] (44).
{standard input}:707: Error: Invalid operands

preprocessed source attached.

(incidentally, we also see this while building glibc...)

randolph
--  
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [parisc-linux] Re: gcc-3.[02] alignment problem
  2002-07-16  5:00 [parisc-linux] gcc-3.[02] alignment problem Randolph Chung
  2002-07-16  5:01 ` [parisc-linux] " Randolph Chung
@ 2002-07-16  5:01 ` Randolph Chung
  2002-07-16 10:18 ` [parisc-linux] " Alan Cox
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Randolph Chung @ 2002-07-16  5:01 UTC (permalink / raw)
  To: parisc-linux; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

> preprocessed source attached.

really attached this time <sigh>

randolph
--  
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

[-- Attachment #2: tcp_diag.i.gz --]
[-- Type: application/octet-stream, Size: 92238 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [parisc-linux] Re: gcc-3.[02] alignment problem
  2002-07-16  5:00 [parisc-linux] gcc-3.[02] alignment problem Randolph Chung
@ 2002-07-16  5:01 ` Randolph Chung
  2002-07-16  5:01 ` Randolph Chung
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Randolph Chung @ 2002-07-16  5:01 UTC (permalink / raw)
  To: parisc-linux; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

> preprocessed source attached.

really attached this time <sigh>

randolph
--  
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

[-- Attachment #2: tcp_diag.i.gz --]
[-- Type: application/octet-stream, Size: 92238 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16  5:00 [parisc-linux] gcc-3.[02] alignment problem Randolph Chung
                   ` (2 preceding siblings ...)
  2002-07-16 10:18 ` [parisc-linux] " Alan Cox
@ 2002-07-16 10:18 ` Alan Cox
  2002-07-16 12:26 ` Carlos O'Donell
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Alan Cox @ 2002-07-16 10:18 UTC (permalink / raw)
  To: Randolph Chung; +Cc: parisc-linux, gcc

On Tue, 2002-07-16 at 06:00, Randolph Chung wrote:
> Compiling the linux kernel (2.4.19-rc1-ac5) with hppa64-linux-gcc 
> (3.0.4 or 3.2) gives:
> 
> tausq@a500:~/src/linux-2.4.19-rc1/net/ipv4$ hppa64-linux-gcc -D__KERNEL__ -I/home/tausq/src/linux-2.4.19-rc1/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -D__linux__ -pipe -fno-strength-reduce -mno-space-regs -mfast-indirect-calls -mdisable-fpregs -ffunction-sections -march=2.0 -mschedule=8000   -nostdinc -I /usr/lib/gcc-lib/hppa64-linux/3.0/include -DKBUILD_BASENAME=tcp_diag  -c -o tcp_diag.o tcp_diag.c
> {standard input}: Assembler messages:
> {standard input}:138: Error: Field not properly aligned [8] (44).
> {standard input}:138: Error: Invalid operands

The pa-risc tree has a disgusting hack to work around this. Its one of
the bits I have down in the "vomit grade" pile of bits to look into
during the rest of the merge.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16  5:00 [parisc-linux] gcc-3.[02] alignment problem Randolph Chung
  2002-07-16  5:01 ` [parisc-linux] " Randolph Chung
  2002-07-16  5:01 ` Randolph Chung
@ 2002-07-16 10:18 ` Alan Cox
  2002-07-16 10:18 ` Alan Cox
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Alan Cox @ 2002-07-16 10:18 UTC (permalink / raw)
  To: Randolph Chung; +Cc: parisc-linux, gcc

On Tue, 2002-07-16 at 06:00, Randolph Chung wrote:
> Compiling the linux kernel (2.4.19-rc1-ac5) with hppa64-linux-gcc 
> (3.0.4 or 3.2) gives:
> 
> tausq@a500:~/src/linux-2.4.19-rc1/net/ipv4$ hppa64-linux-gcc -D__KERNEL__ -I/home/tausq/src/linux-2.4.19-rc1/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -D__linux__ -pipe -fno-strength-reduce -mno-space-regs -mfast-indirect-calls -mdisable-fpregs -ffunction-sections -march=2.0 -mschedule=8000   -nostdinc -I /usr/lib/gcc-lib/hppa64-linux/3.0/include -DKBUILD_BASENAME=tcp_diag  -c -o tcp_diag.o tcp_diag.c
> {standard input}: Assembler messages:
> {standard input}:138: Error: Field not properly aligned [8] (44).
> {standard input}:138: Error: Invalid operands

The pa-risc tree has a disgusting hack to work around this. Its one of
the bits I have down in the "vomit grade" pile of bits to look into
during the rest of the merge.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16  5:00 [parisc-linux] gcc-3.[02] alignment problem Randolph Chung
                   ` (3 preceding siblings ...)
  2002-07-16 10:18 ` Alan Cox
@ 2002-07-16 12:26 ` Carlos O'Donell
  2002-07-16 15:11   ` Randolph Chung
  2002-07-16 16:55 ` John David Anglin
  2002-07-16 16:55 ` John David Anglin
  6 siblings, 1 reply; 20+ messages in thread
From: Carlos O'Donell @ 2002-07-16 12:26 UTC (permalink / raw)
  To: Randolph Chung; +Cc: parisc-linux

> Compiling the linux kernel (2.4.19-rc1-ac5) with hppa64-linux-gcc 
> (3.0.4 or 3.2) gives:
> 
> tausq@a500:~/src/linux-2.4.19-rc1/net/ipv4$ hppa64-linux-gcc -D__KERNEL__ -I/home/tausq/src/linux-2.4.19-rc1/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -D__linux__ -pipe -fno-strength-reduce -mno-space-regs -mfast-indirect-calls -mdisable-fpregs -ffunction-sections -march=2.0 -mschedule=8000   -nostdinc -I /usr/lib/gcc-lib/hppa64-linux/3.0/include -DKBUILD_BASENAME=tcp_diag  -c -o tcp_diag.o tcp_diag.c
> {standard input}: Assembler messages:
> {standard input}:138: Error: Field not properly aligned [8] (44).
> {standard input}:138: Error: Invalid operands
> {standard input}:609: Error: Field not properly aligned [8] (44).
> {standard input}:609: Error: Invalid operands
> {standard input}:707: Error: Field not properly aligned [8] (44).
> {standard input}:707: Error: Invalid operands
> 
> preprocessed source attached.
> 
> (incidentally, we also see this while building glibc...)
> 
> randolph

Preprocessed source attached?

Remember we ran into this when building glibc at OLS.... and
we sat there scratching our heads. I'm pretty sure this was the
reason for the hppa-align.dpatch that is part of debianzed gcc?

Randolph: There is a forward email inside the dpatch that says
you were going to try get this patch upstream... ? :)
(gcc 3.0.4 ./debian/patches/hppa-align.dpatch)

c.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16 12:26 ` Carlos O'Donell
@ 2002-07-16 15:11   ` Randolph Chung
  0 siblings, 0 replies; 20+ messages in thread
From: Randolph Chung @ 2002-07-16 15:11 UTC (permalink / raw)
  To: Carlos O'Donell, parisc-linux

> Preprocessed source attached?

I forgot it the first time, tried to send it again, but the source was
too large and it got stopped for moderation...

> Remember we ran into this when building glibc at OLS.... and
> we sat there scratching our heads. I'm pretty sure this was the
> reason for the hppa-align.dpatch that is part of debianzed gcc?

the hppa-align patch is for a different problem aiui, it's so that we
don't do multiple ldcw's on the same cache line. 

in any case, 3.0.4 (which has this patch) gives the same error.

> Randolph: There is a forward email inside the dpatch that says
> you were going to try get this patch upstream... ? :)
> (gcc 3.0.4 ./debian/patches/hppa-align.dpatch)

I've tried, but the gcc folks have put in a different mechanism to do
this, so the patch needs to be reworked, and i haven't gotten back to it
yet.

randolph
--  
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16  5:00 [parisc-linux] gcc-3.[02] alignment problem Randolph Chung
                   ` (5 preceding siblings ...)
  2002-07-16 16:55 ` John David Anglin
@ 2002-07-16 16:55 ` John David Anglin
  6 siblings, 0 replies; 20+ messages in thread
From: John David Anglin @ 2002-07-16 16:55 UTC (permalink / raw)
  To: randolph; +Cc: parisc-linux, gcc

> Compiling the linux kernel (2.4.19-rc1-ac5) with hppa64-linux-gcc 
> (3.0.4 or 3.2) gives:
> 
> tausq@a500:~/src/linux-2.4.19-rc1/net/ipv4$ hppa64-linux-gcc -D__KERNEL__ -I/home/tausq/src/linux-2.4.19-rc1/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -D__linux__ -pipe -fno-strength-reduce -mno-space-regs -mfast-indirect-calls -mdisable-fpregs -ffunction-sections -march=2.0 -mschedule=8000   -nostdinc -I /usr/lib/gcc-lib/hppa64-linux/3.0/include -DKBUILD_BASENAME=tcp_diag  -c -o tcp_diag.o tcp_diag.c
> {standard input}: Assembler messages:
> {standard input}:138: Error: Field not properly aligned [8] (44).
> {standard input}:138: Error: Invalid operands
> {standard input}:609: Error: Field not properly aligned [8] (44).
> {standard input}:609: Error: Invalid operands
> {standard input}:707: Error: Field not properly aligned [8] (44).
> {standard input}:707: Error: Invalid operands

These messages are coming from the assembler (remove "-pipe").  The
first is from "std %r4,44(%r3)".  The offset "44" is not correct for
a store double.  This is probably a problem with pointer arithmetic
in the source.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16  5:00 [parisc-linux] gcc-3.[02] alignment problem Randolph Chung
                   ` (4 preceding siblings ...)
  2002-07-16 12:26 ` Carlos O'Donell
@ 2002-07-16 16:55 ` John David Anglin
  2002-07-16 16:55 ` John David Anglin
  6 siblings, 0 replies; 20+ messages in thread
From: John David Anglin @ 2002-07-16 16:55 UTC (permalink / raw)
  To: randolph; +Cc: parisc-linux, gcc

> Compiling the linux kernel (2.4.19-rc1-ac5) with hppa64-linux-gcc 
> (3.0.4 or 3.2) gives:
> 
> tausq@a500:~/src/linux-2.4.19-rc1/net/ipv4$ hppa64-linux-gcc -D__KERNEL__ -I/home/tausq/src/linux-2.4.19-rc1/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -D__linux__ -pipe -fno-strength-reduce -mno-space-regs -mfast-indirect-calls -mdisable-fpregs -ffunction-sections -march=2.0 -mschedule=8000   -nostdinc -I /usr/lib/gcc-lib/hppa64-linux/3.0/include -DKBUILD_BASENAME=tcp_diag  -c -o tcp_diag.o tcp_diag.c
> {standard input}: Assembler messages:
> {standard input}:138: Error: Field not properly aligned [8] (44).
> {standard input}:138: Error: Invalid operands
> {standard input}:609: Error: Field not properly aligned [8] (44).
> {standard input}:609: Error: Invalid operands
> {standard input}:707: Error: Field not properly aligned [8] (44).
> {standard input}:707: Error: Invalid operands

These messages are coming from the assembler (remove "-pipe").  The
first is from "std %r4,44(%r3)".  The offset "44" is not correct for
a store double.  This is probably a problem with pointer arithmetic
in the source.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
       [not found] <no.id>
  2002-07-16 17:01 ` John David Anglin
@ 2002-07-16 17:01 ` John David Anglin
  2002-07-16 17:22   ` Randolph Chung
  2002-07-16 17:22   ` Randolph Chung
  1 sibling, 2 replies; 20+ messages in thread
From: John David Anglin @ 2002-07-16 17:01 UTC (permalink / raw)
  To: John David Anglin; +Cc: randolph, parisc-linux, gcc

> These messages are coming from the assembler (remove "-pipe").  The
> first is from "std %r4,44(%r3)".  The offset "44" is not correct for
> a store double.  This is probably a problem with pointer arithmetic
> in the source.

Check the definition of RTA_ALIGNTO in linux/rtnetlink.h.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
       [not found] <no.id>
@ 2002-07-16 17:01 ` John David Anglin
  2002-07-16 17:01 ` John David Anglin
  1 sibling, 0 replies; 20+ messages in thread
From: John David Anglin @ 2002-07-16 17:01 UTC (permalink / raw)
  To: John David Anglin; +Cc: randolph, parisc-linux, gcc

> These messages are coming from the assembler (remove "-pipe").  The
> first is from "std %r4,44(%r3)".  The offset "44" is not correct for
> a store double.  This is probably a problem with pointer arithmetic
> in the source.

Check the definition of RTA_ALIGNTO in linux/rtnetlink.h.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16 17:01 ` John David Anglin
@ 2002-07-16 17:22   ` Randolph Chung
  2002-07-16 17:24     ` Matthew Wilcox
                       ` (3 more replies)
  2002-07-16 17:22   ` Randolph Chung
  1 sibling, 4 replies; 20+ messages in thread
From: Randolph Chung @ 2002-07-16 17:22 UTC (permalink / raw)
  To: John David Anglin; +Cc: parisc-linux, gcc

In reference to a message from John David Anglin, dated Jul 16:
> > These messages are coming from the assembler (remove "-pipe").  The
> > first is from "std %r4,44(%r3)".  The offset "44" is not correct for
> > a store double.  This is probably a problem with pointer arithmetic
> > in the source.
> 
> Check the definition of RTA_ALIGNTO in linux/rtnetlink.h.

ah, this is not it, but i see what it is now.

include/linux/tcp_diag.h defines:

struct tcpdiag_sockid
{
        __u16   tcpdiag_sport;
        __u16   tcpdiag_dport;
        __u32   tcpdiag_src[4];
        __u32   tcpdiag_dst[4];
        __u32   tcpdiag_if;
        __u32   tcpdiag_cookie[2]; 
#define TCPDIAG_NOCOOKIE (~0U)
};

the code goes on to do:
        *((struct sock **)&r->id.tcpdiag_cookie) = sk;
and
            sk != *((struct sock **)&req->id.tcpdiag_cookie[0]))

even tho tcpdiag_cookie looks like it can be 64-bit aligned in the
struct, it appears that it isn't.... 

the "vomit grade hack" alan mentioned in another post is that in our
tree, we have:

struct tcpdiag_sockid
{
        __u16   tcpdiag_sport;
        __u16   tcpdiag_dport;
        __u32   tcpdiag_src[4];
        __u32   tcpdiag_dst[4];
        __u32   tcpdiag_if;
#if defined (__hppa__) && defined (__LP64__)
        char * parisc_hack_to_align_tcpdiag_cookie;
#endif
        __u32   tcpdiag_cookie[2];
#define TCPDIAG_NOCOOKIE (~0U)
};

why is the offset of tcpdiag_cookie[0] 44 and not 40?

randolph
--  
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16 17:01 ` John David Anglin
  2002-07-16 17:22   ` Randolph Chung
@ 2002-07-16 17:22   ` Randolph Chung
  1 sibling, 0 replies; 20+ messages in thread
From: Randolph Chung @ 2002-07-16 17:22 UTC (permalink / raw)
  To: John David Anglin; +Cc: parisc-linux, gcc

In reference to a message from John David Anglin, dated Jul 16:
> > These messages are coming from the assembler (remove "-pipe").  The
> > first is from "std %r4,44(%r3)".  The offset "44" is not correct for
> > a store double.  This is probably a problem with pointer arithmetic
> > in the source.
> 
> Check the definition of RTA_ALIGNTO in linux/rtnetlink.h.

ah, this is not it, but i see what it is now.

include/linux/tcp_diag.h defines:

struct tcpdiag_sockid
{
        __u16   tcpdiag_sport;
        __u16   tcpdiag_dport;
        __u32   tcpdiag_src[4];
        __u32   tcpdiag_dst[4];
        __u32   tcpdiag_if;
        __u32   tcpdiag_cookie[2]; 
#define TCPDIAG_NOCOOKIE (~0U)
};

the code goes on to do:
        *((struct sock **)&r->id.tcpdiag_cookie) = sk;
and
            sk != *((struct sock **)&req->id.tcpdiag_cookie[0]))

even tho tcpdiag_cookie looks like it can be 64-bit aligned in the
struct, it appears that it isn't.... 

the "vomit grade hack" alan mentioned in another post is that in our
tree, we have:

struct tcpdiag_sockid
{
        __u16   tcpdiag_sport;
        __u16   tcpdiag_dport;
        __u32   tcpdiag_src[4];
        __u32   tcpdiag_dst[4];
        __u32   tcpdiag_if;
#if defined (__hppa__) && defined (__LP64__)
        char * parisc_hack_to_align_tcpdiag_cookie;
#endif
        __u32   tcpdiag_cookie[2];
#define TCPDIAG_NOCOOKIE (~0U)
};

why is the offset of tcpdiag_cookie[0] 44 and not 40?

randolph
--  
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16 17:22   ` Randolph Chung
@ 2002-07-16 17:24     ` Matthew Wilcox
  2002-07-17  3:19       ` Randolph Chung
  2002-07-17  3:19       ` Randolph Chung
  2002-07-16 17:24     ` Matthew Wilcox
                       ` (2 subsequent siblings)
  3 siblings, 2 replies; 20+ messages in thread
From: Matthew Wilcox @ 2002-07-16 17:24 UTC (permalink / raw)
  To: Randolph Chung; +Cc: John David Anglin, parisc-linux, gcc

On Tue, Jul 16, 2002 at 10:22:55AM -0700, Randolph Chung wrote:
> include/linux/tcp_diag.h defines:
> 
> struct tcpdiag_sockid
> {
>         __u16   tcpdiag_sport;
>         __u16   tcpdiag_dport;
>         __u32   tcpdiag_src[4];
>         __u32   tcpdiag_dst[4];
>         __u32   tcpdiag_if;
>         __u32   tcpdiag_cookie[2]; 
> #define TCPDIAG_NOCOOKIE (~0U)
> };

> why is the offset of tcpdiag_cookie[0] 44 and not 40?

0	tcpdiag_sport
2	tcpdiag_dport
4	tcpdiag_src
20	tcpdiag_dst
36	tcpdiag_if
40	tcpdiag_cookie

hmm.. worth checking that dport is at offset 2, not offset 4?

-- 
Revolutions do not require corporate support.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16 17:22   ` Randolph Chung
  2002-07-16 17:24     ` Matthew Wilcox
@ 2002-07-16 17:24     ` Matthew Wilcox
  2002-07-16 20:21     ` Richard Henderson
  2002-07-16 20:21     ` Richard Henderson
  3 siblings, 0 replies; 20+ messages in thread
From: Matthew Wilcox @ 2002-07-16 17:24 UTC (permalink / raw)
  To: Randolph Chung; +Cc: John David Anglin, parisc-linux, gcc

On Tue, Jul 16, 2002 at 10:22:55AM -0700, Randolph Chung wrote:
> include/linux/tcp_diag.h defines:
> 
> struct tcpdiag_sockid
> {
>         __u16   tcpdiag_sport;
>         __u16   tcpdiag_dport;
>         __u32   tcpdiag_src[4];
>         __u32   tcpdiag_dst[4];
>         __u32   tcpdiag_if;
>         __u32   tcpdiag_cookie[2]; 
> #define TCPDIAG_NOCOOKIE (~0U)
> };

> why is the offset of tcpdiag_cookie[0] 44 and not 40?

0	tcpdiag_sport
2	tcpdiag_dport
4	tcpdiag_src
20	tcpdiag_dst
36	tcpdiag_if
40	tcpdiag_cookie

hmm.. worth checking that dport is at offset 2, not offset 4?

-- 
Revolutions do not require corporate support.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16 17:22   ` Randolph Chung
                       ` (2 preceding siblings ...)
  2002-07-16 20:21     ` Richard Henderson
@ 2002-07-16 20:21     ` Richard Henderson
  3 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2002-07-16 20:21 UTC (permalink / raw)
  To: Randolph Chung; +Cc: John David Anglin, parisc-linux, gcc

On Tue, Jul 16, 2002 at 10:22:55AM -0700, Randolph Chung wrote:
>         __u32   tcpdiag_cookie[2]; 
> #define TCPDIAG_NOCOOKIE (~0U)
> };
> 
> the code goes on to do:
>         *((struct sock **)&r->id.tcpdiag_cookie) = sk;
> and
>             sk != *((struct sock **)&req->id.tcpdiag_cookie[0]))

This is absolutely awful.

> the "vomit grade hack" alan mentioned in another post is that in our
> tree, we have:
> 
> struct tcpdiag_sockid
> {
>         __u16   tcpdiag_sport;
>         __u16   tcpdiag_dport;
>         __u32   tcpdiag_src[4];
>         __u32   tcpdiag_dst[4];
>         __u32   tcpdiag_if;
> #if defined (__hppa__) && defined (__LP64__)
>         char * parisc_hack_to_align_tcpdiag_cookie;
> #endif
>         __u32   tcpdiag_cookie[2];

An only marginally better fix is

	__u32 tcpdiag_cookie[2] __attribute__((aligned(sizeof(void*))));

Note that this should be unconditional so that the other
64-bit ports don't take an alignment trap here too.

A much nicer fix would be to, gasp, use a union.



r~

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16 17:22   ` Randolph Chung
  2002-07-16 17:24     ` Matthew Wilcox
  2002-07-16 17:24     ` Matthew Wilcox
@ 2002-07-16 20:21     ` Richard Henderson
  2002-07-16 20:21     ` Richard Henderson
  3 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2002-07-16 20:21 UTC (permalink / raw)
  To: Randolph Chung; +Cc: John David Anglin, parisc-linux, gcc

On Tue, Jul 16, 2002 at 10:22:55AM -0700, Randolph Chung wrote:
>         __u32   tcpdiag_cookie[2]; 
> #define TCPDIAG_NOCOOKIE (~0U)
> };
> 
> the code goes on to do:
>         *((struct sock **)&r->id.tcpdiag_cookie) = sk;
> and
>             sk != *((struct sock **)&req->id.tcpdiag_cookie[0]))

This is absolutely awful.

> the "vomit grade hack" alan mentioned in another post is that in our
> tree, we have:
> 
> struct tcpdiag_sockid
> {
>         __u16   tcpdiag_sport;
>         __u16   tcpdiag_dport;
>         __u32   tcpdiag_src[4];
>         __u32   tcpdiag_dst[4];
>         __u32   tcpdiag_if;
> #if defined (__hppa__) && defined (__LP64__)
>         char * parisc_hack_to_align_tcpdiag_cookie;
> #endif
>         __u32   tcpdiag_cookie[2];

An only marginally better fix is

	__u32 tcpdiag_cookie[2] __attribute__((aligned(sizeof(void*))));

Note that this should be unconditional so that the other
64-bit ports don't take an alignment trap here too.

A much nicer fix would be to, gasp, use a union.



r~

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16 17:24     ` Matthew Wilcox
@ 2002-07-17  3:19       ` Randolph Chung
  2002-07-17  3:19       ` Randolph Chung
  1 sibling, 0 replies; 20+ messages in thread
From: Randolph Chung @ 2002-07-17  3:19 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: John David Anglin, parisc-linux, gcc

> > why is the offset of tcpdiag_cookie[0] 44 and not 40?
> 
> 0	tcpdiag_sport
> 2	tcpdiag_dport
> 4	tcpdiag_src
> 20	tcpdiag_dst
> 36	tcpdiag_if
> 40	tcpdiag_cookie
> 
> hmm.. worth checking that dport is at offset 2, not offset 4?

oic, it's embedded inside another structure:

struct tcpdiagmsg
{
        __u8    tcpdiag_family;
        __u8    tcpdiag_state;
        __u8    tcpdiag_timer;
        __u8    tcpdiag_retrans;

        struct tcpdiag_sockid id;

        __u32   tcpdiag_expires;
        __u32   tcpdiag_rqueue;
        __u32   tcpdiag_wqueue;
        __u32   tcpdiag_uid;
        __u32   tcpdiag_inode;
};

that's why it's 44...

randolph

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [parisc-linux] gcc-3.[02] alignment problem
  2002-07-16 17:24     ` Matthew Wilcox
  2002-07-17  3:19       ` Randolph Chung
@ 2002-07-17  3:19       ` Randolph Chung
  1 sibling, 0 replies; 20+ messages in thread
From: Randolph Chung @ 2002-07-17  3:19 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: John David Anglin, parisc-linux, gcc

> > why is the offset of tcpdiag_cookie[0] 44 and not 40?
> 
> 0	tcpdiag_sport
> 2	tcpdiag_dport
> 4	tcpdiag_src
> 20	tcpdiag_dst
> 36	tcpdiag_if
> 40	tcpdiag_cookie
> 
> hmm.. worth checking that dport is at offset 2, not offset 4?

oic, it's embedded inside another structure:

struct tcpdiagmsg
{
        __u8    tcpdiag_family;
        __u8    tcpdiag_state;
        __u8    tcpdiag_timer;
        __u8    tcpdiag_retrans;

        struct tcpdiag_sockid id;

        __u32   tcpdiag_expires;
        __u32   tcpdiag_rqueue;
        __u32   tcpdiag_wqueue;
        __u32   tcpdiag_uid;
        __u32   tcpdiag_inode;
};

that's why it's 44...

randolph

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2002-07-17  3:19 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-16  5:00 [parisc-linux] gcc-3.[02] alignment problem Randolph Chung
2002-07-16  5:01 ` [parisc-linux] " Randolph Chung
2002-07-16  5:01 ` Randolph Chung
2002-07-16 10:18 ` [parisc-linux] " Alan Cox
2002-07-16 10:18 ` Alan Cox
2002-07-16 12:26 ` Carlos O'Donell
2002-07-16 15:11   ` Randolph Chung
2002-07-16 16:55 ` John David Anglin
2002-07-16 16:55 ` John David Anglin
  -- strict thread matches above, loose matches on Subject: below --
2002-07-16  5:00 Randolph Chung
     [not found] <no.id>
2002-07-16 17:01 ` John David Anglin
2002-07-16 17:01 ` John David Anglin
2002-07-16 17:22   ` Randolph Chung
2002-07-16 17:24     ` Matthew Wilcox
2002-07-17  3:19       ` Randolph Chung
2002-07-17  3:19       ` Randolph Chung
2002-07-16 17:24     ` Matthew Wilcox
2002-07-16 20:21     ` Richard Henderson
2002-07-16 20:21     ` Richard Henderson
2002-07-16 17:22   ` Randolph Chung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox