Subject: Re: i386 build bombs on
To: None <tech-smp@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-smp
Date: 01/26/2002 23:11:02
In article <200201220348.TAA02016@gulag.araneus.fi>,
Andreas Gustafsson <gson@gson.org> wrote:
>I am running a -current i386 system where /usr/src/sys/arch/i386 is
>checked out from the sommerfeld_i386mp_1 branch.  When rebuilding the
>system using build.sh, I got the following error:
>
>   CC=/usr/src/tools/obj/tools.NetBSD-1.5ZA-i386/bin/i386--netbsdelf-gcc
>/usr/src/tools/obj/tools.NetBSD-1.5ZA-i386/bin/i386--netbsdelf-lint
>-chapbxzF -w -X 272 -d /destdir/usr/include -D_LIBC -DNLS -DYP -DHESIOD
>-DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT -I/usr/src/lib/libc/include
>-DINET6 -D__DBINTERFACE_PRIVATE
>-I/usr/src/lib/libc/../../libexec/ld.elf_so -I/usr/src/lib/libc/dlfcn
>-DWITH_RUNE -DRUNEMOD_MAJOR=3
>-D_PATH_LOCALEMODULE=\"/usr/lib/runemodule\" -DRESOLVSORT -I.
>-DPOSIX_MISTAKE -DPORTMAP -DFLOATING_POINT -i LintSysNoerr.c
>   /destdir/usr/include/machine/atomic.h(49): warning: conversion from
>'unsigned long' may lose accuracy [132]
>   *** Error code 1
>
>Is this a bug, or am I doing something wrong?  In any case, I worked
>around it with the following change:
>
>Index: atomic.h
>===================================================================
>RCS file: /cvsroot/syssrc/sys/arch/i386/include/Attic/atomic.h,v
>retrieving revision 1.1.2.5
>diff -u -r1.1.2.5 atomic.h
>--- atomic.h	2001/12/11 23:52:07	1.1.2.5
>+++ atomic.h	2002/01/22 03:47:59
>@@ -44,7 +44,7 @@
> #ifndef _LOCORE
> 
> static __inline u_int32_t
>-i386_atomic_testset_ul (volatile u_int32_t *ptr, unsigned long val) {
>+i386_atomic_testset_ul (volatile u_int32_t *ptr, unsigned int val) {
>     __asm__ volatile ("xchgl %0,(%2)" :"=r" (val):"0" (val),"r" (ptr));
>     return val;
> }

err... Tell Mr. Bill. The correct fix is actually.

christos

diff -u -r1.1.2.5 atomic.h
--- atomic.h    2001/12/11 23:52:07     1.1.2.5
+++ atomic.h    2002/01/26 23:10:09
@@ -43,7 +43,7 @@
 
 #ifndef _LOCORE
 
-static __inline u_int32_t
+static __inline unsigned long
 i386_atomic_testset_ul (volatile u_int32_t *ptr, unsigned long val) {
     __asm__ volatile ("xchgl %0,(%2)" :"=r" (val):"0" (val),"r" (ptr));
     return val;
@@ -67,4 +67,3 @@
 
 #endif
 #endif