lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YzSh78fbBg8Oi4EB@bergen.fjasle.eu>
Date:   Wed, 28 Sep 2022 21:35:11 +0200
From:   Nicolas Schier <nicolas@...sle.eu>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arch@...r.kernel.org,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Nathan Chancellor <nathan@...nel.org>
Subject: Re: [PATCH v3 3/7] kbuild: move .vmlinux.objs rule to
 Makefile.modpost

On Sun, 25 Sep 2022 03:19:11 +0900 Masahiro Yamada wrote:
> .vmlinux.objs is used by modpost, so scripts/Makefile.modpost is
> a better place to generate it.
> 
> It is used only when CONFIG_MODVERSIONS=y. It should be guarded
> by "ifdef CONFIG_MODVERSIONS".
> 
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> ---

Reviewed-by: Nicolas Schier <nicolas@...sle.eu>

> (no changes since v1)
> 
>  Makefile                 |  2 +-
>  scripts/Makefile.modpost | 30 ++++++++++++++++++++++++++++--
>  scripts/link-vmlinux.sh  | 18 ------------------
>  3 files changed, 29 insertions(+), 21 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index f793c3b1eaec..92413b6de451 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1477,7 +1477,7 @@ endif # CONFIG_MODULES
>  # Directories & files removed with 'make clean'
>  CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
>  	       modules.builtin modules.builtin.modinfo modules.nsdeps \
> -	       compile_commands.json .thinlto-cache
> +	       compile_commands.json .thinlto-cache .vmlinux.objs
>  
>  # Directories & files removed with 'make mrproper'
>  MRPROPER_FILES += include/config include/generated          \
> diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
> index 911606496341..04ad00917b2f 100644
> --- a/scripts/Makefile.modpost
> +++ b/scripts/Makefile.modpost
> @@ -57,6 +57,32 @@ vmlinux.symvers: vmlinux.o
>  
>  __modpost: vmlinux.symvers
>  
> +# Generate the list of in-tree objects in vmlinux
> +# ---------------------------------------------------------------------------
> +
> +# This is used to retrieve symbol versions generated by genksyms.
> +ifdef CONFIG_MODVERSIONS
> +vmlinux.symvers: .vmlinux.objs
> +endif
> +
> +# Ignore libgcc.a
> +# Some architectures do '$(CC) --print-libgcc-file-name' to borrow libgcc.a
> +# from the toolchain, but there is no EXPORT_SYMBOL in it.
> +
> +quiet_cmd_vmlinux_objs = GEN     $@
> +      cmd_vmlinux_objs =		\
> +	for f in $(real-prereqs); do	\
> +		case $${f} in		\
> +		*libgcc.a) ;;		\
> +		*.a) $(AR) t $${f} ;;	\
> +		*) echo $${f} ;;	\
> +		esac			\
> +	done > $@
> +
> +targets += .vmlinux.objs
> +.vmlinux.objs: $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) FORCE
> +	$(call if_changed,vmlinux_objs)
> +
>  else
>  
>  ifeq ($(KBUILD_EXTMOD),)
> @@ -134,6 +160,8 @@ ifneq ($(KBUILD_MODPOST_NOFINAL),1)
>  	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
>  endif
>  
> +endif
> +
>  PHONY += FORCE
>  FORCE:
>  
> @@ -141,6 +169,4 @@ existing-targets := $(wildcard $(sort $(targets)))
>  
>  -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
>  
> -endif
> -
>  .PHONY: $(PHONY)
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 8d982574145a..161bca64e8aa 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -199,7 +199,6 @@ cleanup()
>  	rm -f System.map
>  	rm -f vmlinux
>  	rm -f vmlinux.map
> -	rm -f .vmlinux.objs
>  	rm -f .vmlinux.export.c
>  }
>  
> @@ -218,23 +217,6 @@ fi
>  #link vmlinux.o
>  ${MAKE} -f "${srctree}/scripts/Makefile.vmlinux_o"
>  
> -# Generate the list of in-tree objects in vmlinux
> -#
> -# This is used to retrieve symbol versions generated by genksyms.
> -for f in ${KBUILD_VMLINUX_OBJS} ${KBUILD_VMLINUX_LIBS}; do
> -	case ${f} in
> -	*libgcc.a)
> -		# Some architectures do '$(CC) --print-libgcc-file-name' to
> -		# borrow libgcc.a from the toolchain.
> -		# There is no EXPORT_SYMBOL in external objects. Ignore this.
> -		;;
> -	*.a)
> -		${AR} t ${f} ;;
> -	*)
> -		echo ${f} ;;
> -	esac
> -done > .vmlinux.objs
> -
>  # modpost vmlinux.o to check for section mismatches
>  ${MAKE} -f "${srctree}/scripts/Makefile.modpost" MODPOST_VMLINUX=1
>  
> -- 
> 2.34.1

-- 
epost|xmpp: nicolas@...sle.eu          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ