All of lore.kernel.org
 help / color / mirror / Atom feed
* [peterz-queue:module/namespace 8/8] <inline asm>:1191:93: error: unexpected token
@ 2024-11-16 22:49 kernel test robot
  2024-11-17 11:32 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2024-11-16 22:49 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git module/namespace
head:   eddf030901699351844504fd2232ae7ea6d1e787
commit: eddf030901699351844504fd2232ae7ea6d1e787 [8/8] x86/kvm: Testing...
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20241117/202411170618.NtapXkN9-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241117/202411170618.NtapXkN9-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411170618.NtapXkN9-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from arch/x86/kvm/x86.c:20:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> <inline asm>:1191:93: error: unexpected token
    1191 | .section ".export_symbol","a" ; __export_symbol_kvm_caps: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_caps ; .previous
         |                                                                                             ^
   <inline asm>:1192:93: error: unexpected token
    1192 | .section ".export_symbol","a" ; __export_symbol_kvm_host: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_host ; .previous
         |                                                                                             ^
   <inline asm>:2783:104: error: unexpected token
    2783 | .section ".export_symbol","a" ; __export_symbol_report_ignored_msrs: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad report_ignored_msrs ; .previous
         |                                                                                                        ^
   <inline asm>:2784:107: error: unexpected token
    2784 | .section ".export_symbol","a" ; __export_symbol_enable_vmware_backdoor: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad enable_vmware_backdoor ; .previous
         |                                                                                                           ^
   <inline asm>:2785:95: error: unexpected token
    2785 | .section ".export_symbol","a" ; __export_symbol_enable_pmu: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad enable_pmu ; .previous
         |                                                                                               ^
   <inline asm>:2786:101: error: unexpected token
    2786 | .section ".export_symbol","a" ; __export_symbol_kvm_nr_uret_msrs: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_nr_uret_msrs ; .previous
         |                                                                                                     ^
   <inline asm>:2787:109: error: unexpected token
    2787 | .section ".export_symbol","a" ; __export_symbol_allow_smaller_maxphyaddr: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad allow_smaller_maxphyaddr ; .previous
         |                                                                                                             ^
   <inline asm>:2788:97: error: unexpected token
    2788 | .section ".export_symbol","a" ; __export_symbol_enable_apicv: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad enable_apicv ; .previous
         |                                                                                                 ^
   <inline asm>:2789:108: error: unexpected token
    2789 | .section ".export_symbol","a" ; __export_symbol_kvm_add_user_return_msr: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_add_user_return_msr ; .previous
         |                                                                                                            ^
   <inline asm>:2790:109: error: unexpected token
    2790 | .section ".export_symbol","a" ; __export_symbol_kvm_find_user_return_msr: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_find_user_return_msr ; .previous
         |                                                                                                             ^
   <inline asm>:2791:108: error: unexpected token
    2791 | .section ".export_symbol","a" ; __export_symbol_kvm_set_user_return_msr: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_set_user_return_msr ; .previous
         |                                                                                                            ^
   <inline asm>:2792:102: error: unexpected token
    2792 | .section ".export_symbol","a" ; __export_symbol_kvm_get_apic_mode: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_get_apic_mode ; .previous
         |                                                                                                      ^
   <inline asm>:2793:103: error: unexpected token
    2793 | .section ".export_symbol","a" ; __export_symbol_kvm_spurious_fault: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_spurious_fault ; .previous
         |                                                                                                       ^
   <inline asm>:2794:114: error: unexpected token
    2794 | .section ".export_symbol","a" ; __export_symbol_kvm_deliver_exception_payload: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_deliver_exception_payload ; .previous
         |                                                                                                                  ^
   <inline asm>:2795:104: error: unexpected token
    2795 | .section ".export_symbol","a" ; __export_symbol_kvm_queue_exception: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_queue_exception ; .previous
         |                                                                                                        ^
   <inline asm>:2796:106: error: unexpected token
    2796 | .section ".export_symbol","a" ; __export_symbol_kvm_requeue_exception: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_requeue_exception ; .previous
         |                                                                                                          ^
   <inline asm>:2797:106: error: unexpected token
    2797 | .section ".export_symbol","a" ; __export_symbol_kvm_queue_exception_p: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_queue_exception_p ; .previous
         |                                                                                                          ^
   <inline asm>:2798:105: error: unexpected token
    2798 | .section ".export_symbol","a" ; __export_symbol_kvm_complete_insn_gp: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_complete_insn_gp ; .previous
         |                                                                                                         ^
   <inline asm>:2799:115: error: unexpected token
    2799 | .section ".export_symbol","a" ; __export_symbol_kvm_inject_emulated_page_fault: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_inject_emulated_page_fault ; .previous
         |                                                                                                                   ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   4 warnings and 20 errors generated.

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [peterz-queue:module/namespace 8/8] <inline asm>:1191:93: error: unexpected token
  2024-11-16 22:49 [peterz-queue:module/namespace 8/8] <inline asm>:1191:93: error: unexpected token kernel test robot
@ 2024-11-17 11:32 ` Peter Zijlstra
  2024-11-18 10:45   ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2024-11-17 11:32 UTC (permalink / raw)
  To: kernel test robot; +Cc: llvm, oe-kbuild-all

On Sun, Nov 17, 2024 at 06:49:12AM +0800, kernel test robot wrote:

>     1191 | .section ".export_symbol","a" ; __export_symbol_kvm_caps: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_caps ; .previous
>          |                                                                                             ^

Urgh.. so GCC does the expected string concatenation here, while LLVM is
having a wobble because it expects a single string constant, and not
two.

I've tried the whole CONCATENATE() trick, but that doesn't work right
for strings.

And I'm not sure what else to try.. The whole of C is build on the
expectation that two string constants are merged into one, but LLVM
integrated assembler clearly disagrees :-/

Anybody?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [peterz-queue:module/namespace 8/8] <inline asm>:1191:93: error: unexpected token
  2024-11-17 11:32 ` Peter Zijlstra
@ 2024-11-18 10:45   ` Peter Zijlstra
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2024-11-18 10:45 UTC (permalink / raw)
  To: kernel test robot; +Cc: llvm, oe-kbuild-all

On Sun, Nov 17, 2024 at 12:32:12PM +0100, Peter Zijlstra wrote:
> On Sun, Nov 17, 2024 at 06:49:12AM +0800, kernel test robot wrote:
> 
> >     1191 | .section ".export_symbol","a" ; __export_symbol_kvm_caps: ; .asciz "GPL" ; .asciz "MODULE_" "kvm,kvm-intel,kvm-amd" ; .balign 8 ; .quad kvm_caps ; .previous
> >          |                                                                                             ^
> 
> Urgh.. so GCC does the expected string concatenation here, while LLVM is
> having a wobble because it expects a single string constant, and not
> two.
> 
> I've tried the whole CONCATENATE() trick, but that doesn't work right
> for strings.
> 
> And I'm not sure what else to try.. The whole of C is build on the
> expectation that two string constants are merged into one, but LLVM
> integrated assembler clearly disagrees :-/
> 
> Anybody?

Made it work like so.

diff --git a/include/linux/export.h b/include/linux/export.h
index 176671624420..2bf1eb80c86b 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -24,11 +24,23 @@
 	.long sym
 #endif
 
-#define ___EXPORT_SYMBOL(sym, license, ns)		\
+/*
+ * LLVM intregrated assembler refuses to merge adjacent string literals (like
+ * C and GNU-as) and chokes on:
+ *
+ *   .asciz "MODULE_" "kvm" ;
+ *
+ * As would be generated when using EXPORT_SYMBOL_GPL_FOR(foo, "kvm"), use
+ * varargs to assemble it like so:
+ *
+ *   .ascii "MODULE_", "kvm", "\0" ;
+ *
+ */
+#define ___EXPORT_SYMBOL(sym, license, ns...)		\
 	.section ".export_symbol","a"		ASM_NL	\
 	__export_symbol_##sym:			ASM_NL	\
 		.asciz license			ASM_NL	\
-		.asciz ns			ASM_NL	\
+		.ascii ns, "\0"			ASM_NL	\
 		__EXPORT_SYMBOL_REF(sym)	ASM_NL	\
 	.previous
 
@@ -39,20 +51,20 @@
  * be reused in other execution contexts such as the UEFI stub or the
  * decompressor.
  */
-#define __EXPORT_SYMBOL(sym, license, ns)
+#define __EXPORT_SYMBOL(sym, license, ns...)
 
 #elif defined(__GENKSYMS__)
 
-#define __EXPORT_SYMBOL(sym, license, ns)	__GENKSYMS_EXPORT_SYMBOL(sym)
+#define __EXPORT_SYMBOL(sym, license, ns...)	__GENKSYMS_EXPORT_SYMBOL(sym)
 
 #elif defined(__ASSEMBLY__)
 
-#define __EXPORT_SYMBOL(sym, license, ns) \
+#define __EXPORT_SYMBOL(sym, license, ns...) \
 	___EXPORT_SYMBOL(sym, license, ns)
 
 #else
 
-#define __EXPORT_SYMBOL(sym, license, ns)			\
+#define __EXPORT_SYMBOL(sym, license, ns...)			\
 	extern typeof(sym) sym;					\
 	__ADDRESSABLE(sym)					\
 	asm(__stringify(___EXPORT_SYMBOL(sym, license, ns)))
@@ -68,9 +80,8 @@
 #define EXPORT_SYMBOL(sym)		_EXPORT_SYMBOL(sym, "")
 #define EXPORT_SYMBOL_GPL(sym)		_EXPORT_SYMBOL(sym, "GPL")
 #define EXPORT_SYMBOL_NS(sym, ns)	__EXPORT_SYMBOL(sym, "", ns)
-#define EXPORT_SYMBOL_NS_GPL(sym, ns)	__EXPORT_SYMBOL(sym, "GPL", ns)
+#define EXPORT_SYMBOL_NS_GPL(sym, ns...)	__EXPORT_SYMBOL(sym, "GPL", ns)
 
-#define EXPORT_SYMBOL_FOR(sym, mods)	EXPORT_SYMBOL_NS(sym, "MODULE_" mods)
-#define EXPORT_SYMBOL_GPL_FOR(sym, mods) EXPORT_SYMBOL_NS_GPL(sym, "MODULE_" mods)
+#define EXPORT_SYMBOL_GPL_FOR(sym, mods) EXPORT_SYMBOL_NS_GPL(sym, "MODULE_", mods)
 
 #endif /* _LINUX_EXPORT_H */

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-18 10:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-16 22:49 [peterz-queue:module/namespace 8/8] <inline asm>:1191:93: error: unexpected token kernel test robot
2024-11-17 11:32 ` Peter Zijlstra
2024-11-18 10:45   ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.