linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: add LDFLAGS_KERNEL to pass additional linker flags for vmlinux
@ 2018-07-06  6:34 Masahiro Yamada
  0 siblings, 0 replies; only message in thread
From: Masahiro Yamada @ 2018-07-06  6:34 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Sam Ravnborg, Masahiro Yamada, linux-doc, linux-kernel,
	Jonathan Corbet, Michal Marek

Kbuild provides LDFLAGS_MODULE to allows users to give additional
options for linking modules, but there is no way to append flags for
linking vmlinux.

It is true LDFLAGS_vmlinux specifies the linker options for vmlinux,
but it is only for internal-use.

We have CFLAGS_KERNEL, AFLAGS_KERNEL already, so LDFLAGS_KERNEL is
the same pattern.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 Documentation/kbuild/kbuild.txt | 4 ++++
 Makefile                        | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 6c9c69e..f3a0a47 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -46,6 +46,10 @@ CFLAGS_MODULE
 --------------------------------------------------
 Additional module specific options to use for $(CC).
 
+LDFLAGS_KERNEL
+--------------------------------------------------
+Additional options used for $(LD) when linking vmlinux.
+
 LDFLAGS_MODULE
 --------------------------------------------------
 Additional options used for $(LD) when linking modules.
diff --git a/Makefile b/Makefile
index 58bd78b..6f9f4b1 100644
--- a/Makefile
+++ b/Makefile
@@ -848,6 +848,8 @@ ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
 LDFLAGS_vmlinux	+= $(call ld-option, -X,)
 endif
 
+LDFLAGS_vmlinux += $(LDFLAGS_KERNEL)
+
 # insure the checker run with the right endianness
 CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian)
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-06  6:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-06  6:34 [PATCH] kbuild: add LDFLAGS_KERNEL to pass additional linker flags for vmlinux Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).