svn commit: r223262 - in head: cddl/contrib/opensolaris/lib/libdtrace/common contrib/binutils/bfd contrib/binutils/gas contrib/binutils/gas/config contrib/binutils/ld contrib/binutils/opcodes contr...

Simon L. B. Nielsen simon at nitro.dk
Sun Jun 19 08:38:52 UTC 2011


On 18 Jun 2011, at 22:48, Jilles Tjoelker wrote:

> On Sat, Jun 18, 2011 at 01:56:33PM +0000, Ben Laurie wrote:
>> Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
>> ==============================================================================
>> --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c	Sat Jun 18 13:54:36 2011	(r223261)
>> +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c	Sat Jun 18 13:56:33 2011	(r223262)
>> @@ -45,6 +45,7 @@
>> #include <assert.h>
>> #include <libgen.h>
>> #include <limits.h>
>> +#include <stdint.h>
>> 
>> #include <dt_impl.h>
>> 
>> @@ -811,15 +812,14 @@ dt_basename(char *str)
>> ulong_t
>> dt_popc(ulong_t x)
>> {
>> -#ifdef _ILP32
>> +#if defined(_ILP32)
>> 	x = x - ((x >> 1) & 0x55555555UL);
>> 	x = (x & 0x33333333UL) + ((x >> 2) & 0x33333333UL);
>> 	x = (x + (x >> 4)) & 0x0F0F0F0FUL;
>> 	x = x + (x >> 8);
>> 	x = x + (x >> 16);
>> 	return (x & 0x3F);
>> -#endif
>> -#ifdef _LP64
>> +#elif defined(_LP64)
>> 	x = x - ((x >> 1) & 0x5555555555555555ULL);
>> 	x = (x & 0x3333333333333333ULL) + ((x >> 2) & 0x3333333333333333ULL);
>> 	x = (x + (x >> 4)) & 0x0F0F0F0F0F0F0F0FULL;
>> @@ -827,6 +827,8 @@ dt_popc(ulong_t x)
>> 	x = x + (x >> 16);
>> 	x = x + (x >> 32);
>> 	return (x & 0x7F);
>> +#else
>> +# warning need td_popc() implementation
>> #endif
>> }
> 
> This commit uncovers breakage that had been present for a while. If I
> compile this on stable/8 i386 for head i386, _ILP32 is not defined and
> the warning is hit, breaking the build. Apparently, the code had been
> broken for a while but I do not use dtrace so I would not have noticed.
> The tinderboxes have now also noticed the problem so it is not something
> weird about my system.

What would be the correct (at least temporary) fix?  Replace the _ILP32 / _LP64 checks with specific architecture checks ?

I can see that on i386 _ILP32  isn't actually defined - but on amd64 _LP64 is... and it still breaks.

[simon at zaphod:~] ssh ref9-i386.freebsd.org 'cpp -dM < /dev/null | grep LP'
[simon at zaphod:~] ssh ref9-amd64.freebsd.org 'cpp -dM < /dev/null | grep LP'
#define __LP64__ 1
#define _LP64 1
[simon at zaphod:~] ssh ref8-amd64.freebsd.org 'cpp -dM < /dev/null | grep LP'
#define __LP64__ 1
#define _LP64 1

I must be missing something...

-- 
Simon L. B. Nielsen



More information about the svn-src-all mailing list