diff mbox series

kbuild: add LDFLAGS_KERNEL to pass additional linker flags for vmlinux

Message ID 1530858843-14997-1-git-send-email-yamada.masahiro@socionext.com
State New
Headers show
Series kbuild: add LDFLAGS_KERNEL to pass additional linker flags for vmlinux | expand

Commit Message

Masahiro Yamada July 6, 2018, 6:34 a.m. UTC
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(+)

-- 
2.7.4
diff mbox series

Patch

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)