kbuild: add CONFIG_ASM_MODVERSIONS
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 19 Aug 2019 05:54:20 +0000 (14:54 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 21 Aug 2019 16:14:11 +0000 (01:14 +0900)
Add CONFIG_ASM_MODVERSIONS. This allows to remove one if-conditional
nesting in scripts/Makefile.build.

scripts/Makefile.build is run every time Kbuild descends into a
sub-directory. So, I want to avoid $(wildcard ...) evaluation
where possible although computing $(wildcard ...) is so cheap that
it may not make measurable performance difference.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
14 files changed:
arch/Kconfig
arch/alpha/Kconfig
arch/arm64/Kconfig
arch/ia64/Kconfig
arch/m68k/Kconfig
arch/mips/Kconfig
arch/powerpc/Kconfig
arch/riscv/Kconfig
arch/s390/Kconfig
arch/sparc/Kconfig
arch/um/Kconfig
arch/x86/Kconfig
init/Kconfig
scripts/Makefile.build

index a7b57dd42c26698b319430ac65cd81610ba08b71..7d7b1b6af85166a73e2424950671a095f5309819 100644 (file)
@@ -289,6 +289,13 @@ config ARCH_32BIT_OFF_T
          still support 32-bit off_t. This option is enabled for all such
          architectures explicitly.
 
          still support 32-bit off_t. This option is enabled for all such
          architectures explicitly.
 
+config HAVE_ASM_MODVERSIONS
+       bool
+       help
+         This symbol should be selected by an architecure if it provides
+         <asm/asm-prototypes.h> to support the module versioning for symbols
+         exported from assembly code.
+
 config HAVE_REGS_AND_STACK_ACCESS_API
        bool
        help
 config HAVE_REGS_AND_STACK_ACCESS_API
        bool
        help
index f7b19b813a70199bdf8cf48029c5d3f1932fc2aa..ef179033a7c2149f3dffe8c4aeeb536058454471 100644 (file)
@@ -11,6 +11,7 @@ config ALPHA
        select PCI_DOMAINS if PCI
        select PCI_SYSCALL if PCI
        select HAVE_AOUT
        select PCI_DOMAINS if PCI
        select PCI_SYSCALL if PCI
        select HAVE_AOUT
+       select HAVE_ASM_MODVERSIONS
        select HAVE_IDE
        select HAVE_OPROFILE
        select HAVE_PCSPKR_PLATFORM
        select HAVE_IDE
        select HAVE_OPROFILE
        select HAVE_PCSPKR_PLATFORM
index 3adcec05b1f672d7ff3356e0eaf13d2667a64b6a..cb16d4ade6aaf51efbfd708f8e1af737ae193f1d 100644 (file)
@@ -135,6 +135,7 @@ config ARM64
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE
        select HAVE_ARCH_VMAP_STACK
        select HAVE_ARM_SMCCC
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE
        select HAVE_ARCH_VMAP_STACK
        select HAVE_ARM_SMCCC
+       select HAVE_ASM_MODVERSIONS
        select HAVE_EBPF_JIT
        select HAVE_C_RECORDMCOUNT
        select HAVE_CMPXCHG_DOUBLE
        select HAVE_EBPF_JIT
        select HAVE_C_RECORDMCOUNT
        select HAVE_CMPXCHG_DOUBLE
index 7468d8e504672a711e34a09984f2601f0cad6b1b..3dead116a6d78bbf56dd28081b8222732b6c4c8f 100644 (file)
@@ -17,6 +17,7 @@ config IA64
        select FORCE_PCI if (!IA64_HP_SIM)
        select PCI_DOMAINS if PCI
        select PCI_SYSCALL if PCI
        select FORCE_PCI if (!IA64_HP_SIM)
        select PCI_DOMAINS if PCI
        select PCI_SYSCALL if PCI
+       select HAVE_ASM_MODVERSIONS
        select HAVE_UNSTABLE_SCHED_CLOCK
        select HAVE_EXIT_THREAD
        select HAVE_IDE
        select HAVE_UNSTABLE_SCHED_CLOCK
        select HAVE_EXIT_THREAD
        select HAVE_IDE
index c518d695c3760745a3d468f570208448eff16652..00a20fa0bdcc2af0786707cfca250467620a589b 100644 (file)
@@ -14,6 +14,7 @@ config M68K
        select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE
        select HAVE_IDE
        select HAVE_AOUT if MMU
        select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE
        select HAVE_IDE
        select HAVE_AOUT if MMU
+       select HAVE_ASM_MODVERSIONS
        select HAVE_DEBUG_BUGVERBOSE
        select GENERIC_IRQ_SHOW
        select GENERIC_ATOMIC64
        select HAVE_DEBUG_BUGVERBOSE
        select GENERIC_IRQ_SHOW
        select GENERIC_ATOMIC64
index d50fafd7bf3aed0fac0729312b2d3aecd905e0c4..3db919b5c93a4130ae75c2f5e275220a4fc708c2 100644 (file)
@@ -44,6 +44,7 @@ config MIPS
        select HAVE_ARCH_SECCOMP_FILTER
        select HAVE_ARCH_TRACEHOOK
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT
        select HAVE_ARCH_SECCOMP_FILTER
        select HAVE_ARCH_TRACEHOOK
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT
+       select HAVE_ASM_MODVERSIONS
        select HAVE_EBPF_JIT if (!CPU_MICROMIPS)
        select HAVE_CONTEXT_TRACKING
        select HAVE_COPY_THREAD_TLS
        select HAVE_EBPF_JIT if (!CPU_MICROMIPS)
        select HAVE_CONTEXT_TRACKING
        select HAVE_COPY_THREAD_TLS
index 77f6ebf97113cea548e360c942b81041a7b10027..5be32ad8f47be1086edc2935d6a5296c40c812e4 100644 (file)
@@ -178,6 +178,7 @@ config PPC
        select HAVE_ARCH_NVRAM_OPS
        select HAVE_ARCH_SECCOMP_FILTER
        select HAVE_ARCH_TRACEHOOK
        select HAVE_ARCH_NVRAM_OPS
        select HAVE_ARCH_SECCOMP_FILTER
        select HAVE_ARCH_TRACEHOOK
+       select HAVE_ASM_MODVERSIONS
        select HAVE_C_RECORDMCOUNT
        select HAVE_CBPF_JIT                    if !PPC64
        select HAVE_STACKPROTECTOR              if PPC64 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r13)
        select HAVE_C_RECORDMCOUNT
        select HAVE_CBPF_JIT                    if !PPC64
        select HAVE_STACKPROTECTOR              if PPC64 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r13)
index 59a4727ecd6c074672e82d8bb4ec7638912957f6..66603f02675a7826ea54dfef3b8bc290415d6df9 100644 (file)
@@ -31,6 +31,7 @@ config RISCV
        select GENERIC_SMP_IDLE_THREAD
        select GENERIC_ATOMIC64 if !64BIT
        select HAVE_ARCH_AUDITSYSCALL
        select GENERIC_SMP_IDLE_THREAD
        select GENERIC_ATOMIC64 if !64BIT
        select HAVE_ARCH_AUDITSYSCALL
+       select HAVE_ASM_MODVERSIONS
        select HAVE_MEMBLOCK_NODE_MAP
        select HAVE_DMA_CONTIGUOUS
        select HAVE_FUTEX_CMPXCHG if FUTEX
        select HAVE_MEMBLOCK_NODE_MAP
        select HAVE_DMA_CONTIGUOUS
        select HAVE_FUTEX_CMPXCHG if FUTEX
index a4ad2733eedf652d7f215b3091341f1e1d938571..c06ebe34e0f973299eae7be874053fcdd0c2b915 100644 (file)
@@ -131,6 +131,7 @@ config S390
        select HAVE_ARCH_TRACEHOOK
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE
        select HAVE_ARCH_VMAP_STACK
        select HAVE_ARCH_TRACEHOOK
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE
        select HAVE_ARCH_VMAP_STACK
+       select HAVE_ASM_MODVERSIONS
        select HAVE_EBPF_JIT if PACK_STACK && HAVE_MARCH_Z196_FEATURES
        select HAVE_CMPXCHG_DOUBLE
        select HAVE_CMPXCHG_LOCAL
        select HAVE_EBPF_JIT if PACK_STACK && HAVE_MARCH_Z196_FEATURES
        select HAVE_CMPXCHG_DOUBLE
        select HAVE_CMPXCHG_LOCAL
index 7926a2e11bdc2d2561c39ad17d1efde27f23ffd4..fbc1aecf0f94ce085bc099c82c2b4a555e7a8b6c 100644 (file)
@@ -17,6 +17,7 @@ config SPARC
        select ARCH_MIGHT_HAVE_PC_SERIO
        select OF
        select OF_PROMTREE
        select ARCH_MIGHT_HAVE_PC_SERIO
        select OF
        select OF_PROMTREE
+       select HAVE_ASM_MODVERSIONS
        select HAVE_IDE
        select HAVE_OPROFILE
        select HAVE_ARCH_KGDB if !SMP || SPARC64
        select HAVE_IDE
        select HAVE_OPROFILE
        select HAVE_ARCH_KGDB if !SMP || SPARC64
index 3c3adfc486f21d70059bc7906d8e57772e287008..fec6b4ca2b6e543d6bf6bca9c8d6469185edee7b 100644 (file)
@@ -9,6 +9,7 @@ config UML
        select ARCH_NO_PREEMPT
        select HAVE_ARCH_AUDITSYSCALL
        select HAVE_ARCH_SECCOMP_FILTER
        select ARCH_NO_PREEMPT
        select HAVE_ARCH_AUDITSYSCALL
        select HAVE_ARCH_SECCOMP_FILTER
+       select HAVE_ASM_MODVERSIONS
        select HAVE_UID16
        select HAVE_FUTEX_CMPXCHG if FUTEX
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_UID16
        select HAVE_FUTEX_CMPXCHG if FUTEX
        select HAVE_DEBUG_KMEMLEAK
index 222855cc0158422f1d6dddc2d9307cb606433a37..66bb9f25e9dffbae30b0e5e73c712d9c88134645 100644 (file)
@@ -147,6 +147,7 @@ config X86
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD if X86_64
        select HAVE_ARCH_VMAP_STACK             if X86_64
        select HAVE_ARCH_WITHIN_STACK_FRAMES
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD if X86_64
        select HAVE_ARCH_VMAP_STACK             if X86_64
        select HAVE_ARCH_WITHIN_STACK_FRAMES
+       select HAVE_ASM_MODVERSIONS
        select HAVE_CMPXCHG_DOUBLE
        select HAVE_CMPXCHG_LOCAL
        select HAVE_CONTEXT_TRACKING            if X86_64
        select HAVE_CMPXCHG_DOUBLE
        select HAVE_CMPXCHG_LOCAL
        select HAVE_CONTEXT_TRACKING            if X86_64
index bd7d650d4a996c7c10d2349a340f52c1f99c1e49..bf971b5c707de0eeb12bfa00abf234079dedfbac 100644 (file)
@@ -1989,6 +1989,14 @@ config MODVERSIONS
          make them incompatible with the kernel you are running.  If
          unsure, say N.
 
          make them incompatible with the kernel you are running.  If
          unsure, say N.
 
+config ASM_MODVERSIONS
+       bool
+       default HAVE_ASM_MODVERSIONS && MODVERSIONS
+       help
+         This enables module versioning for exported symbols also from
+         assembly. This can be enabled only when the target architecture
+         supports it.
+
 config MODULE_REL_CRCS
        bool
        depends on MODVERSIONS
 config MODULE_REL_CRCS
        bool
        depends on MODVERSIONS
index 10adf3b558de5eb818205514c43194c33365f135..9fa09361aa5ddcc66039e6d2d36cb1c1de8c953a 100644 (file)
@@ -349,11 +349,7 @@ $(obj)/%.s: $(src)/%.S FORCE
 quiet_cmd_as_o_S = AS $(quiet_modtag)  $@
       cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
 
 quiet_cmd_as_o_S = AS $(quiet_modtag)  $@
       cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
 
-ifdef CONFIG_MODVERSIONS
-
-ASM_PROTOTYPES := $(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/asm-prototypes.h)
-
-ifneq ($(ASM_PROTOTYPES),)
+ifdef CONFIG_ASM_MODVERSIONS
 
 # versioning matches the C process described above, with difference that
 # we parse asm-prototypes.h C header to get function definitions.
 
 # versioning matches the C process described above, with difference that
 # we parse asm-prototypes.h C header to get function definitions.
@@ -369,7 +365,6 @@ cmd_modversions_S =                                                         \
                rm -f $(@D)/.tmp_$(@F:.o=.ver);                                 \
        fi
 endif
                rm -f $(@D)/.tmp_$(@F:.o=.ver);                                 \
        fi
 endif
-endif
 
 $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE
        $(call if_changed_rule,as_o_S)
 
 $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE
        $(call if_changed_rule,as_o_S)