public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* Re: Bug#652356: please use argument-safe bswap macros on all architectures
       [not found]     ` <20111217112848.GG9956@hall.aurel32.net>
@ 2011-12-17 13:00       ` Thorsten Glaser
  2011-12-17 18:12         ` Andreas Schwab
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Glaser @ 2011-12-17 13:00 UTC (permalink / raw)
  To: libc-ports; +Cc: 652356, debian-glibc

Aurelien Jarno dixit:

>I am not an m68k porter, and I am not planning to try things. m68k is
>lagging upstream wrt other architectures. Please work with upstream to
>fix things, then I can include tested and accepted patches.

I’m not an m68k porter either, but this fix is easily done from working
with a libc (BSD libc in my case) skills. But okay. Am I guessing that
libc-ports@sourceware.org is “upstream”? It was hard to find information
about eglibc-ports on the ’net.

Anyway, here it is:


Dixi quod…

>Aurelien Jarno dixit:
>
>>I have dropped it in favor of the default version for the next upload.
>
>Why don’t you just use these? (Tested for 32-bit and 64-bit both.)
>I’ve not looked at other architectures atm though.
>
>--- usr/include/m68k-linux-gnu/bits/byteswap.h~	2011-12-17 02:44:08.000000000 +0000
>+++ usr/include/m68k-linux-gnu/bits/byteswap.h	2011-12-17 02:49:34.000000000 +0000
>@@ -1,5 +1,5 @@
> /* Macros to swap the order of bytes in integer values.  m68k version.
>-   Copyright (C) 1997, 2002, 2008 Free Software Foundation, Inc.
>+   Copyright (C) 1997, 2002, 2008, 2011 Free Software Foundation, Inc.
>    This file is part of the GNU C Library.
> 
>    The GNU C Library is free software; you can redistribute it and/or
>@@ -50,15 +50,15 @@
> #if defined __GNUC__ && __GNUC__ >= 2 && !defined(__mcoldfire__)
> # define __bswap_32(x) \
>   __extension__							\
>-  ({ unsigned int __bswap_32_v;					\
>-     if (__builtin_constant_p (x))				\
>-       __bswap_32_v = __bswap_constant_32 (x);			\
>+  ({ unsigned int __bswap_32_v, __bswap_32_x = (x);		\
>+     if (__builtin_constant_p (__bswap_32_x))			\
>+       __bswap_32_v = __bswap_constant_32 (__bswap_32_x);	\
>      else							\
>        __asm__ __volatile__ ("ror%.w %#8, %0;"			\
> 			     "swap %0;"				\
> 			     "ror%.w %#8, %0"			\
> 			     : "=d" (__bswap_32_v)		\
>-			     : "0" ((unsigned int) (x)));	\
>+			     : "0" (__bswap_32_x));		\
>      __bswap_32_v; })
> #else
> static __inline unsigned int
>@@ -85,11 +85,12 @@
>   __extension__								\
>   ({ union { unsigned long long int __ll;				\
> 	     unsigned long int __l[2]; } __bswap_64_v, __bswap_64_r;	\
>-     if (__builtin_constant_p (x))					\
>-       __bswap_64_r.__ll = __bswap_constant_64 (x);			\
>+     unsigned long long int __bswap_64_x = (x);				\
>+     if (__builtin_constant_p (__bswap_64_x))				\
>+       __bswap_64_r.__ll = __bswap_constant_64 (__bswap_64_x);		\
>      else								\
>        {								\
>-	 __bswap_64_v.__ll = (x);					\
>+	 __bswap_64_v.__ll = __bswap_64_x;				\
> 	 __bswap_64_r.__l[0] = __bswap_32 (__bswap_64_v.__l[1]);	\
> 	 __bswap_64_r.__l[1] = __bswap_32 (__bswap_64_v.__l[0]);	\
>        }								\


Aurelien Jarno dixit:

>Other architectures don't have this problem with byteswap.h

I see. I didn’t know that for sure, so I suggested that in
general someone should look at it.

bye,
//mirabilos

PS: Please fix your MTA; hall.aurel32.net is sending 8-bit
    data to a receiving MTA that does not announce 8BITMIME
    support in its EHLO response. Or your MUA to use Quoted-
    Printable by default.
-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
	-- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

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

* Re: Bug#652356: please use argument-safe bswap macros on all architectures
  2011-12-17 13:00       ` Bug#652356: please use argument-safe bswap macros on all architectures Thorsten Glaser
@ 2011-12-17 18:12         ` Andreas Schwab
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2011-12-17 18:12 UTC (permalink / raw)
  To: Thorsten Glaser; +Cc: libc-ports, 652356, debian-glibc

Thorsten Glaser <tg@mirbsd.de> writes:

> Aurelien Jarno dixit:
>
>>I am not an m68k porter, and I am not planning to try things. m68k is
>>lagging upstream wrt other architectures. Please work with upstream to
>>fix things, then I can include tested and accepted patches.
>
> I’m not an m68k porter either, but this fix is easily done from working
> with a libc (BSD libc in my case) skills. But okay. Am I guessing that
> libc-ports@sourceware.org is “upstream”? It was hard to find information
> about eglibc-ports on the ’net.
>
> Anyway, here it is:

This has already been fixed a long time ago.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

end of thread, other threads:[~2011-12-17 18:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.BSM.4.64L.1112161525050.856@herc.mirbsd.org>
     [not found] ` <20111217005242.GE9956@hall.aurel32.net>
     [not found]   ` <Pine.BSM.4.64L.1112170250430.856@herc.mirbsd.org>
     [not found]     ` <20111217112848.GG9956@hall.aurel32.net>
2011-12-17 13:00       ` Bug#652356: please use argument-safe bswap macros on all architectures Thorsten Glaser
2011-12-17 18:12         ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).