All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb+git@google.com>
To: linux-kernel@vger.kernel.org
Cc: x86@kernel.org, linux-kbuild@vger.kernel.org,
	 Ard Biesheuvel <ardb@kernel.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Ingo Molnar <mingo@kernel.org>
Subject: [RFC PATCH 1/4] Kbuild/link-vmlinux.sh: Make output file name configurable
Date: Mon, 24 Feb 2025 14:21:34 +0100	[thread overview]
Message-ID: <20250224132132.1765115-7-ardb+git@google.com> (raw)
In-Reply-To: <20250224132132.1765115-6-ardb+git@google.com>

From: Ard Biesheuvel <ardb@kernel.org>

In order to introduce an intermediate, non-stripped vmlinux build that
can be used by other build steps as an input, pass the output file name
to link-vmlinux.sh via its command line.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 scripts/Makefile.vmlinux |  2 +-
 scripts/link-vmlinux.sh  | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
index 873caaa55313..3523ce3ce3dc 100644
--- a/scripts/Makefile.vmlinux
+++ b/scripts/Makefile.vmlinux
@@ -69,7 +69,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
 
 # Final link of vmlinux with optional arch pass after final link
 cmd_link_vmlinux =							\
-	$< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)";		\
+	$< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)" "$@";	\
 	$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
 
 targets += vmlinux
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 56a077d204cf..e55026128e05 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -31,6 +31,7 @@ set -e
 LD="$1"
 KBUILD_LDFLAGS="$2"
 LDFLAGS_vmlinux="$3"
+VMLINUX="$4"
 
 is_enabled() {
 	grep -q "^$1=y" include/config/auto.conf
@@ -278,7 +279,7 @@ fi
 
 strip_debug=
 
-vmlinux_link vmlinux
+vmlinux_link "${VMLINUX}"
 
 # fill in BTF IDs
 if is_enabled CONFIG_DEBUG_INFO_BTF; then
@@ -290,11 +291,11 @@ if is_enabled CONFIG_DEBUG_INFO_BTF; then
 	${RESOLVE_BTFIDS} ${RESOLVE_BTFIDS_ARGS} vmlinux
 fi
 
-mksysmap vmlinux System.map
+mksysmap "${VMLINUX}" System.map
 
 if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then
-	info SORTTAB vmlinux
-	if ! sorttable vmlinux; then
+	info SORTTAB "${VMLINUX}"
+	if ! sorttable "${VMLINUX}"; then
 		echo >&2 Failed to sort kernel tables
 		exit 1
 	fi
@@ -310,4 +311,4 @@ if is_enabled CONFIG_KALLSYMS; then
 fi
 
 # For fixdep
-echo "vmlinux: $0" > .vmlinux.d
+echo "${VMLINUX}: $0" > ".${VMLINUX}.d"
-- 
2.48.1.601.g30ceb7b040-goog


  reply	other threads:[~2025-02-24 13:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24 13:21 [RFC PATCH 0/4] x86/build: Get rid of vmlinux postlink step Ard Biesheuvel
2025-02-24 13:21 ` Ard Biesheuvel [this message]
2025-02-24 13:21 ` [RFC PATCH 2/4] Kbuild: Introduce Kconfig symbol for linking vmlinux with relocations Ard Biesheuvel
2025-03-07 18:58   ` Masahiro Yamada
2025-02-24 13:21 ` [RFC PATCH 3/4] Kbuild: Create intermediate vmlinux build with relocations preserved Ard Biesheuvel
2025-03-07 19:04   ` Masahiro Yamada
2025-02-24 13:21 ` [RFC PATCH 4/4] x86: Get rid of Makefile.postlink Ard Biesheuvel
2025-02-24 18:51 ` [RFC PATCH 0/4] x86/build: Get rid of vmlinux postlink step Ingo Molnar
2025-02-24 19:59   ` Linus Torvalds
2025-02-24 21:25     ` Ard Biesheuvel
2025-02-24 21:28   ` Ard Biesheuvel
2025-03-06 16:47 ` Ard Biesheuvel
2025-03-07 18:54   ` Masahiro Yamada
2025-03-08 10:49     ` Ard Biesheuvel
2025-03-08 16:17       ` Masahiro Yamada
2025-03-08 22:42         ` Ard Biesheuvel
2025-03-09  9:48           ` Ingo Molnar
2025-03-11  2:38             ` Masahiro Yamada
2025-03-11  6:40               ` Ard Biesheuvel
2025-03-11  9:52                 ` Masahiro Yamada
2025-03-11 16:00                 ` Petr Pavlu
2025-03-13 10:31                 ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250224132132.1765115-7-ardb+git@google.com \
    --to=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mingo@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.