[PATCH] powerpc/math-emu: Fix building with clang

Joel Stanley joel at jms.id.au
Fri Nov 2 14:37:13 AEDT 2018


  make CC=clang-8 ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu-  ppc44x_defconfig
  make CC=clang-8 ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu-

  ...

  arch/powerpc/math-emu/fnmsub.c:46:2: error: invalid use of a cast in a
  inline asm context requiring an l-value: remove the cast or build with
  -fheinous-gnu-extensions
          FP_ADD_D(R, T, B);
          ^~~~~~~~~~~~~~~~~
  ./include/math-emu/double.h:110:27: note: expanded from macro 'FP_ADD_D'
  #define FP_ADD_D(R,X,Y)                 _FP_ADD(D,2,R,X,Y)
                                          ^~~~~~~~~~~~~~~~~~
  ./include/math-emu/op-common.h:367:34: note: expanded from macro '_FP_ADD'
  #define _FP_ADD(fs, wc, R, X, Y) _FP_ADD_INTERNAL(fs, wc, R, X, Y, '+')
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ./include/math-emu/op-common.h:264:4: note: expanded from macro '_FP_ADD_INTERNAL'
            _FP_FRAC_ADD_##wc(R, X, Y);                                        \
            ^~~~~~~~~~~~~~~~~~~~~~~~~~
  note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
  ./include/math-emu/op-2.h:94:27: note: expanded from macro '_FP_FRAC_ADD_2'
    __FP_FRAC_ADD_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)
    ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link: https://github.com/ClangBuiltLinux/linux/issues/260
Signed-off-by: Joel Stanley <joel at jms.id.au>
---
 arch/powerpc/math-emu/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/math-emu/Makefile b/arch/powerpc/math-emu/Makefile
index 494df26c5988..b9cb797445ac 100644
--- a/arch/powerpc/math-emu/Makefile
+++ b/arch/powerpc/math-emu/Makefile
@@ -18,3 +18,7 @@ CFLAGS_fabs.o = -fno-builtin-fabs
 CFLAGS_math.o = -fno-builtin-fabs
 
 ccflags-y = -I. -Iinclude/math-emu -w
+
+ifdef CONFIG_CC_IS_CLANG
+ccflags-y += -fheinous-gnu-extensions
+endif
-- 
2.19.1



More information about the Linuxppc-dev mailing list