@@ -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.
@@ -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)
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