[RTEMS Project] #1443: PowerPC in_cksum() requires optimization

RTEMS trac trac at rtems.org
Wed Feb 18 14:37:38 UTC 2015


#1443: PowerPC in_cksum() requires optimization
------------------------+---------------------
 Reporter:  dufault     |       Owner:
     Type:  defect      |      Status:  new
 Priority:  normal      |   Milestone:  4.10.3
Component:  networking  |     Version:  4.10
 Severity:  normal      |  Resolution:
 Keywords:              |
------------------------+---------------------
Changes (by sebastian.huber):

 * owner:  sebastian.huber =>
 * status:  assigned => new


Old description:

> I had built with optimization off for debugging.  Without optimization
> the in_cksum() in rtems/cpukit/libnetworking/netinet/in_cksum_powerpc.h
> is returning 1.  With -O2 in effect it is returning 0.
>
> I put a breakpoint after the call to in_cksum() (tcp_input.c:320) with
> the only change recompiling tcp_input.c with and without optimization.
>
> Checksum with tcp_input.c compiled with -O2:
> (gdb) print ti->ti_t.th_sum
> $1 = 0x0
> (gdb)
>
> Checksum with tcp_input.c compiled without any optimization:
> (gdb) print ti->ti_t.th_sum
> $1 = 0x1
> (gdb)
>
> This is for the MPC5554, with the same compilation flags as for the
> MPC55xxevb.  Here is what the compilation line is for in_cksum.c and
> tcp_input.c (with -O2 taken out and I added -DDEBUG=1):
>
> powerpc-rtems4.10-gcc --pipe -DHAVE_CONFIG_H   -I..
> -I../../cpukit/../../../mpc5554som/lib/include
> -I../../../../../../rtems-4.9.99.0/c/src/../../cpukit/libnetworking
> -DINET -DNFS -DDIAGNOSTIC -DBOOTP_COMPAT -D_KERNEL -D__BSD_VISIBLE  -Wall
> -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs
> -fasm -mcpu=8540 -meabi -msdata -fno-common -msoft-float -DDEBUG=1
> -D__ppc_generic -mstrict-align -g -fno-keep-inline-functions -MT netinet
> /libnetworking_a-in_cksum.o -MD -MP -MF netinet/.deps/libnetworking_a-
> in_cksum.Tpo -c -o netinet/libnetworking_a-in_cksum.o `test -f
> 'netinet/in_cksum.c' || echo
> '../../../../../../rtems-4.9.99.0/c/src/../../cpukit/libnetworking/'`netinet/in_cksum.c
>
> powerpc-rtems4.10-gcc --pipe -DHAVE_CONFIG_H   -I..
> -I../../cpukit/../../../mpc5554som/lib/include
> -I../../../../../../rtems-4.9.99.0/c/src/../../cpukit/libnetworking
> -DINET -DNFS -DDIAGNOSTIC -DBOOTP_COMPAT -D_KERNEL -D__BSD_VISIBLE  -Wall
> -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs
> -fasm -mcpu=8540 -meabi -msdata -fno-common -msoft-float -DDEBUG=1
> -D__ppc_generic -mstrict-align -g -fno-keep-inline-functions -MT netinet
> /libnetworking_a-tcp_input.o -MD -MP -MF netinet/.deps/libnetworking_a-
> tcp_input.Tpo -c -o netinet/libnetworking_a-tcp_input.o `test -f
> 'netinet/tcp_input.c' || echo
> '../../../../../../rtems-4.9.99.0/c/src/../../cpukit/libnetworking/'`netinet/tcp_input.c

New description:

 I had built with optimization off for debugging.  Without optimization the
 in_cksum() in rtems/cpukit/libnetworking/netinet/in_cksum_powerpc.h is
 returning 1.  With -O2 in effect it is returning 0.

 I put a breakpoint after the call to in_cksum() (tcp_input.c:320) with the
 only change recompiling tcp_input.c with and without optimization.

 Checksum with tcp_input.c compiled with -O2:
 (gdb) print ti->ti_t.th_sum
 $1 = 0x0
 (gdb)

 Checksum with tcp_input.c compiled without any optimization:
 (gdb) print ti->ti_t.th_sum
 $1 = 0x1
 (gdb)

 This is for the MPC5554, with the same compilation flags as for the
 MPC55xxevb.  Here is what the compilation line is for in_cksum.c and
 tcp_input.c (with -O2 taken out and I added -DDEBUG=1):

 powerpc-rtems4.10-gcc --pipe -DHAVE_CONFIG_H   -I..
 -I../../cpukit/../../../mpc5554som/lib/include
 -I../../../../../../rtems-4.9.99.0/c/src/../../cpukit/libnetworking -DINET
 -DNFS -DDIAGNOSTIC -DBOOTP_COMPAT -D_KERNEL -D__BSD_VISIBLE  -Wall
 -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -fasm
 -mcpu=8540 -meabi -msdata -fno-common -msoft-float -DDEBUG=1
 -D__ppc_generic -mstrict-align -g -fno-keep-inline-functions -MT netinet
 /libnetworking_a-in_cksum.o -MD -MP -MF netinet/.deps/libnetworking_a-
 in_cksum.Tpo -c -o netinet/libnetworking_a-in_cksum.o `test -f
 'netinet/in_cksum.c' || echo
 '../../../../../../rtems-4.9.99.0/c/src/../../cpukit/libnetworking/'`netinet/in_cksum.c

 powerpc-rtems4.10-gcc --pipe -DHAVE_CONFIG_H   -I..
 -I../../cpukit/../../../mpc5554som/lib/include
 -I../../../../../../rtems-4.9.99.0/c/src/../../cpukit/libnetworking -DINET
 -DNFS -DDIAGNOSTIC -DBOOTP_COMPAT -D_KERNEL -D__BSD_VISIBLE  -Wall
 -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -fasm
 -mcpu=8540 -meabi -msdata -fno-common -msoft-float -DDEBUG=1
 -D__ppc_generic -mstrict-align -g -fno-keep-inline-functions -MT netinet
 /libnetworking_a-tcp_input.o -MD -MP -MF netinet/.deps/libnetworking_a-
 tcp_input.Tpo -c -o netinet/libnetworking_a-tcp_input.o `test -f
 'netinet/tcp_input.c' || echo
 '../../../../../../rtems-4.9.99.0/c/src/../../cpukit/libnetworking/'`netinet/tcp_input.c

--

--
Ticket URL: <http://devel.rtems.org/ticket/1443#comment:11>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list