Skip to contentSkip to conversation

powerpc/math_emu/efp: Include module.h

PATCH Applied Nathan Chancellor 4 participants 6 messages Aug 31, 2022 – Sep 9, 2022 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/math_emu/efp: Include module.h

When building with a recent version of clang, there are a couple of errors around the call to module_init():

arch/powerpc/math-emu/math_efp.c:927:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] module_init(spe_mathemu_init);
^
int
arch/powerpc/math-emu/math_efp.c:927:13: error: a parameter list without types is only allowed in a function definition

  module_init(spe_mathemu_init);
              ^

2 errors generated.

module_init() is a macro, which is not getting expanded because module.h is not included in this file. Add the include so that the macro can expand properly, clearing up the build failure.

---

No Fixes tag because it seems likely that this is a transient include issue (the code builds with GCC). The robot blamed commit e8c07082a810 ("Kbuild: move to -std=gnu11") but I think that just exposed these errors, not caused them.

 arch/powerpc/math-emu/math_efp.c | 1 +
 1 file changed, 1 insertion(+)
arch/powerpc/math-emu/math_efp.c +1 -0
index 39b84e7452e1..aa3bb8da1cb9 100644
@@ -17,6 +17,7 @@
 
 #include <linux/types.h>
 #include <linux/prctl.h>
+#include <linux/module.h>
 
 #include <linux/uaccess.h>
 #include <asm/reg.h>

base-commit: dcf8e5633e2e69ad60b730ab5905608b756a032f

Signature · 1 line
2.37.3
Reviewed-by on v1 1/1
#1 lore raw

Le 31/08/2022 à 17:20, Nathan Chancellor a écrit :

Quoted 16 lines

When building with a recent version of clang, there are a couple of errors around the call to module_init():

   arch/powerpc/math-emu/math_efp.c:927:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
   module_init(spe_mathemu_init);
   ^
   int
   arch/powerpc/math-emu/math_efp.c:927:13: error: a parameter list without types is only allowed in a function definition
   module_init(spe_mathemu_init);
               ^
   2 errors generated.

module_init() is a macro, which is not getting expanded because module.h is not included in this file. Add the include so that the macro can expand properly, clearing up the build failure.

Quoted 8 lines

---

No Fixes tag because it seems likely that this is a transient include issue (the code builds with GCC). The robot blamed commit e8c07082a810 ("Kbuild: move to -std=gnu11") but I think that just exposed these errors, not caused them.

Well spoted.

Seems like a GCC bug. The code builds fine but silently ignores the issue and the following section is missing:

8 .initcall6.init 00000004 00000000 00000000 00008b30 2**2
CONTENTS, ALLOC, LOAD, RELOC, DATA

It means spe_mathemu_init() is never called.

I think it would be worth a GCC bug report.

And by the way:

Fixes ac6f120369ff ("powerpc/85xx: Workaroudn e500 CPU erratum A005")
Quoted 18 lines
  arch/powerpc/math-emu/math_efp.c | 1 +
  1 file changed, 1 insertion(+)
arch/powerpc/math-emu/math_efp.c +1 -0
index 39b84e7452e1..aa3bb8da1cb9 100644
@@ -17,6 +17,7 @@
 
  #include <linux/types.h>
  #include <linux/prctl.h>
+#include <linux/module.h>
 
  #include <linux/uaccess.h>
  #include <asm/reg.h>

base-commit: dcf8e5633e2e69ad60b730ab5905608b756a032f

#2 lore raw
Quoted 1 line · Christophe Leroy

I think it would be worth a GCC bug report.

We need a stand-alone testcase for this. When you have created one, at least 98% of the time you discover the bug is in user code after all.

Which is a very good thing, it means the problem can be fixed simpler, cheaper, and a lot faster :-)

Segher

#3 lore raw

Le 01/09/2022 à 21:47, Segher Boessenkool a écrit :

Quoted 8 lines · Christophe Leroy
Quoted 1 line

I think it would be worth a GCC bug report.

We need a stand-alone testcase for this. When you have created one, at least 98% of the time you discover the bug is in user code after all.

Which is a very good thing, it means the problem can be fixed simpler, cheaper, and a lot faster :-)

Easy to reproduce with a .c file that has a single line:

non_existing_macro(xxx);

Apparently that's due to the -w option in arch/powerpc/math_emu/Makefile:

ccflags-y = -w

Was introduced by commit d2b194ed8208 ("powerpc/math-emu: Use kernel generic math-emu code")

If I understand correctly it means 'ignore all warnings'. Then it seems CLANG doesn't honor that request.

Christophe

#4 lore raw
Quoted 7 lines · Christophe Leroy

Le 01/09/2022 à 21:47, Segher Boessenkool a écrit :

Quoted 6 lines · Christophe Leroy
Quoted 1 line

I think it would be worth a GCC bug report.

We need a stand-alone testcase for this. When you have created one, at least 98% of the time you discover the bug is in user code after all.

Quoted 6 lines
Quoted 2 lines

Which is a very good thing, it means the problem can be fixed simpler, cheaper, and a lot faster :-)

Easy to reproduce with a .c file that has a single line:

non_existing_macro(xxx);

That was fast (and cheap and simple) :-)

Quoted 9 lines

Apparently that's due to the -w option in arch/powerpc/math_emu/Makefile:

ccflags-y = -w

Was introduced by commit d2b194ed8208 ("powerpc/math-emu: Use kernel generic math-emu code")

If I understand correctly it means 'ignore all warnings'. Then it seems CLANG doesn't honor that request.

'-w'
Inhibit all warning messages.

GCC's initial commit has this already (1992).

Segher

#5 lore raw
In reply to Nathan Chancellor
Quoted 8 lines · Nathan Chancellor

When building with a recent version of clang, there are a couple of errors around the call to module_init():

arch/powerpc/math-emu/math_efp.c:927:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] module_init(spe_mathemu_init);
^
int
arch/powerpc/math-emu/math_efp.c:927:13: error: a parameter list without types is only allowed in a function definition

Quoted 5 lines
  module_init(spe_mathemu_init);
              ^

2 errors generated.

[...]

Applied to powerpc/next.

[1/1] powerpc/math_emu/efp: Include module.h

      https://git.kernel.org/powerpc/c/cfe0d370e0788625ce0df3239aad07a2506c1796

cheers