On Tue, Apr 24, 2018 at 3:34 PM, Will Deacon will.deacon@arm.com wrote:
I've not run into any build issues here -- is this specifically with some out-of-tree module?
I received a bug report email about this. I'm not sure which specific module, and I assumed from the email that it was actually a result of in-tree configuration options rather than an out-of-tree module, but I'm not sure exactly. Either way, I was able to reproduce the problem by coding up a little PoC out-of-tree module, so it is certainly a real problem.
It would be better not to introduce a new header file just for this, I think. How about compiler.h instead?
I could, but actually after I wrote this email I noticed that this is a widespread convention:
zx2c4@thinkpad ~/Projects/linux $ subfind asm-prototypes ./arch/s390/include/asm/asm-prototypes.h ./arch/alpha/include/asm/asm-prototypes.h ./arch/powerpc/include/asm/asm-prototypes.h ./arch/m68k/include/asm/asm-prototypes.h ./arch/mips/include/asm/asm-prototypes.h ./arch/x86/include/asm/asm-prototypes.h ./arch/sparc/include/asm/asm-prototypes.h ./arch/ia64/include/asm/asm-prototypes.h ./arch/um/include/asm/asm-prototypes.h ./include/asm-generic/asm-prototypes.h
We normally export asm symbols via arm64ksyms.c. In fact, would doing that remove the need for the explicit declarations completely?
I'm pretty sure it still needs the declaration; otherwise the module hashing will get confused. Also, the EXPORT_SYMBOL macro is a different one when called from assembly versus from C, though not sure that makes a substantive difference. It seems like this is what other architectures are doing:
zx2c4@thinkpad ~/Projects/linux $ rg 'EXPORT_SYMBOL.*__.*[std]i[0-9]' -g '*.S' arch/m68k/lib/modsi3.S 111: EXPORT_SYMBOL(__modsi3)
arch/m68k/lib/umodsi3.S 108: EXPORT_SYMBOL(__umodsi3)
arch/m68k/lib/udivsi3.S 157: EXPORT_SYMBOL(__udivsi3)
arch/m68k/lib/divsi3.S 123: EXPORT_SYMBOL(__divsi3)
arch/m68k/lib/mulsi3.S 105: EXPORT_SYMBOL(__mulsi3)
arch/powerpc/kernel/misc_32.S 529:EXPORT_SYMBOL(__ashrdi3) 541:EXPORT_SYMBOL(__ashldi3) 553:EXPORT_SYMBOL(__lshrdi3) 569:EXPORT_SYMBOL(__cmpdi2) 584:EXPORT_SYMBOL(__ucmpdi2) 596:EXPORT_SYMBOL(__bswapdi2)
arch/powerpc/kernel/misc_64.S 211:EXPORT_SYMBOL(__bswapdi2)
arch/sparc/lib/lshrdi3.S 30:EXPORT_SYMBOL(__lshrdi3)
arch/sparc/lib/muldi3.S 78:EXPORT_SYMBOL(__muldi3)
arch/sparc/lib/divdi3.S 283:EXPORT_SYMBOL(__divdi3)
arch/sparc/lib/ashrdi3.S 40:EXPORT_SYMBOL(__ashrdi3)
arch/sparc/lib/multi3.S 36:EXPORT_SYMBOL(__multi3)
arch/sparc/lib/ashldi3.S 38:EXPORT_SYMBOL(__ashldi3)