m68k in_cksum help needed

Thomas Doerfler Thomas.Doerfler at imd-systems.de
Fri Mar 11 19:18:46 UTC 2005


Hi Joel,


> Hi,
> 
> With the move to gcc4, the m68k specific in_cksum implementation
> is not compiling.  All m68k/coldfire builds end with this error:
> 
> 
> then mv -f "netinet/.deps/libnetworking_a-in_cksum.Tpo" 
> "netinet/.deps/libnetworking_a-in_cksum.Po"; else rm -f 
> "netinet/.deps/libnetworking_a-in_cksum.Tpo"; exit 1; fi
> {standard input}: Assembler messages:
> {standard input}:149: Error: symbol `lcsum1_lbl' is already defined
> {standard input}:149: Error: symbol `lcsum2_lbl' is already defined
> 
> I tried converting lcsum1_lbl and lcsum2_lbl to temporary labels
> and that did not help.
> 

I don't know the exact reason for this bug, especially it seems 
strange it comes up only now. Obviously, with the currently 
toolset the in_chksum macro is included twice in the same C 
module (or GCC performs some duplication to optimize code?).  

If you use "temp labels" as local labels, they are still valid 
in the same module, so things will not get better than. 

Nevertheless, you might work around the problem by using local 
labels. I have coded it, but have no GCC4 toolset installed, so 
maybe the attached patch might fix it. I hope the routine still 
works as desired afterwards!  

wkr,
Thomas.

> I looked at the NetBSD implementation and it is very different
> from this one.
> 
> 
> http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/m68k/m68k/
> 
> Help getting this to compile again would be appreciated.
> 
> Thanks.
> -- 
> Joel Sherrill, Ph.D.             Director of Research & Development
> joel at OARcorp.com                 On-Line Applications Research
> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
>     Support Available             (256) 722-9985

--------------------------------------------
IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler           Herbststrasse 8
D-82178 Puchheim          Germany
email:    Thomas.Doerfler at imd-systems.de
PGP public key available at: http://www.imd-
systems.de/pgp_keys.htm


-------------- next part --------------
--- in_cksum_m68k.h	2005-03-11 19:50:58.814075616 +0100
+++ in_cksum_m68k.h.new	2005-03-11 20:13:47.494004640 +0100
@@ -125,8 +125,8 @@
 #else
 		"andi    #0xf,%%cc   | Clear X (extended carry flag)\n\t"
 #endif
-		"jmp     %%pc@(lcsum2_lbl-.-2:b,%3)  | Jump into loop\n"
-		"lcsum1_lbl:         | Begin inner loop...\n\t"
+		"jmp     %%pc@(2f-.-2:b,%3)  | Jump into loop\n"
+		"1:                  | Begin inner loop...\n\t"
 		"movel   %1 at +,%3     |  0: Fetch 32-bit word\n\t"
 		"addxl   %3,%0       |    Add word + previous carry\n\t"
 		"movel   %1 at +,%3     |  1: Fetch 32-bit word\n\t"
@@ -159,12 +159,12 @@
 		"addxl   %3,%0       |    Add word + previous carry\n\t"
 		"movel   %1 at +,%3     |  F: Fetch 32-bit word\n\t"
 		"addxl   %3,%0       |    Add word + previous carry\n"
-		"lcsum2_lbl:         |  End of unrolled loop\n\t"
+		"2:                  |  End of unrolled loop\n\t"
 #if IS_COLDFIRE
 		"moveq   #0,%3       | Add in last carry\n\t"
 		"addxl   %3,%0       |\n\t"
 		"subql 	 #1,%2       | Update loop count\n\t"
-		"bplb    lcsum1_lbl  | Loop (with X clear) if not done\n\t"
+		"bplb    1b          | Loop (with X clear) if not done\n\t"
 		"movel   #0xffff,%2  | Get word mask\n\t"
 		"movel   %0,%3       | Fold 32 bit sum to 16 bits\n\t"
 		"swap    %3          |\n\t"
@@ -176,7 +176,7 @@
 		"addl    %3,%0       |\n\t"
 		"andl    %2,%0       | Mask to 16-bit sum\n\t"
 #else
-		"dbf     %2,lcsum1_lbl | (NB- dbf doesn't affect X)\n\t"
+		"dbf     %2,1b       | (NB- dbf doesn't affect X)\n\t"
 		"movel   %0,%3       | Fold 32 bit sum to 16 bits\n\t"
 		"swap    %3          | (NB- swap doesn't affect X)\n\t"
 		"addxw   %3,%0       |\n\t"


More information about the users mailing list