PATCH: Add bits/byteswap-16.h and use GCC builtin 32/64-bit bswap
Andreas Jaeger
aj@suse.com
Fri Jun 15 07:42:00 GMT 2012
On 04/24/2012 11:31 AM, Chung-Lin Tang wrote:
> On 2012/4/7 03:40 AM, H.J. Lu wrote:
>> 2012-04-06 H.J. Lu <hongjiu.lu@intel.com>
>>
>> * bits/byteswap.h (__bswap_16): Removed.
>> Include <bits/byteswap-16.h> to get __bswap_16.
>> (__bswap_32): Use __builtin_bswap32 for GCC >= 4.2.
>> (__bswap_64): Use __builtin_bswap64 for GCC >= 4.2.
>> * bits/byteswap-16.h: New file.
>
> For SH, this triggered a build fail, due to those inline C functions
> being added to a assembly file (the SH strlen.S use of endian.h) after a
> complex include sequence.
>
> Of course, there's nothing wrong with those __bswap* functions. It seems
> that string/endian.h includes a bunch of stuff not usable anyways for
> assembler, so here's trivial patch to correct this.
>
> Thanks,
> Chung-Lin
>
> 2012-04-24 Chung-Lin Tang <cltang@codesourcery.com>
>
> * string/endian.h: Add !__ASSEMBLER__ condition for including
> conversion interfaces.
>
coming back to an old email and reversing my opinion...
Having seen this also mentioned on libc-ports, I think we should add the
assembler protection as Chung-Lin proposes in his patch. I'd like
somebody else to comment on this as well...
References:
http://sourceware.org/ml/libc-ports/2012-05/msg00016.html
http://sourceware.org/ml/libc-alpha/2012-04/msg01141.html
Andreas
> diff --git a/string/endian.h b/string/endian.h
> index 0c293f6..51084f1 100644
> --- a/string/endian.h
> +++ b/string/endian.h
> @@ -55,7 +55,7 @@
> #endif
>
>
> -#ifdef __USE_BSD
> +#if defined __USE_BSD && !defined __ASSEMBLER__
> /* Conversion interfaces. */
> # include <bits/byteswap.h>
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
More information about the Libc-alpha
mailing list