Commit 8634de6d authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Linus Torvalds

compiler-gcc: require gcc 4.8 for powerpc __builtin_bswap16()

gcc support for __builtin_bswap16() was supposedly added for powerpc in
gcc 4.6, and was then later added for other architectures in gcc 4.8.

However, Stephen Rothwell reported that attempting to use it on powerpc
in gcc 4.6 fails with:

  lib/vsprintf.c:160:2: error: initializer element is not constant
  lib/vsprintf.c:160:2: error: (near initialization for 'decpair[0]')
  lib/vsprintf.c:160:2: error: initializer element is not constant
  lib/vsprintf.c:160:2: error: (near initialization for 'decpair[1]')
  ...

I'm not entirely sure what those errors mean, but I don't see them on
gcc 4.8.  So let's consider gcc 4.8 to be the official starting point
for __builtin_bswap16().

Arnd Bergmann adds:
 "I found the commit in gcc-4.8 that replaced the powerpc-specific
  implementation of __builtin_bswap16 with an architecture-independent
  one.  Apparently the powerpc version (gcc-4.6 and 4.7) just mapped to
  the lhbrx/sthbrx instructions, so it ended up not being a constant,
  though the intent of the patch was mainly to add support for the
  builtin to x86:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624

  has the patch that went into gcc-4.8 and more information."

Fixes: 7322dd75 ("byteswap: try to avoid __builtin_constant_p gcc bug")
Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Tested-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 44549e8f
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
#define __HAVE_BUILTIN_BSWAP32__ #define __HAVE_BUILTIN_BSWAP32__
#define __HAVE_BUILTIN_BSWAP64__ #define __HAVE_BUILTIN_BSWAP64__
#endif #endif
#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) #if GCC_VERSION >= 40800
#define __HAVE_BUILTIN_BSWAP16__ #define __HAVE_BUILTIN_BSWAP16__
#endif #endif
#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ #endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment