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] [day] [month] [year] [list]
Message-ID: <patch-1.thread-ba6b03.git-dec2f0b867da.your-ad-here.call-01603453670-ext-0242@work.hours>
Date:   Fri, 23 Oct 2020 13:57:38 +0200
From:   Vasily Gorbik <gor@...ux.ibm.com>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     Michal Marek <michal.lkml@...kovi.net>,
        linux-kernel@...r.kernel.org, linux-kbuild@...r.kernel.org
Subject: [PATCH 1/2] kbuild: add config option to save link map file(s)

Add CONFIG_SAVE_LINK_MAP config option, which would make linker to save
link map to vmlinux.map file. Link map is quite useful during making
kernel changes related to how the kernel is composed and debugging
linker scripts. It also provides information about discarded sections
and symbols.

Architectures supporting compressed kernel images might respect
CONFIG_SAVE_LINK_MAP option and produce arch/*/boot/compressed/vmlinux.map
for the decompressor code as well.

Signed-off-by: Vasily Gorbik <gor@...ux.ibm.com>
---
 .gitignore        |  1 +
 Makefile          |  6 +++++-
 lib/Kconfig.debug | 13 +++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index d01cda8e1177..81ba7416a0b6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,6 +48,7 @@
 Module.symvers
 modules.builtin
 modules.order
+vmlinux.map
 
 #
 # Top-level generic files
diff --git a/Makefile b/Makefile
index e71979882e4f..d35a59f98e83 100644
--- a/Makefile
+++ b/Makefile
@@ -984,6 +984,10 @@ ifeq ($(CONFIG_RELR),y)
 LDFLAGS_vmlinux	+= --pack-dyn-relocs=relr
 endif
 
+ifeq ($(CONFIG_SAVE_LINK_MAP),y)
+LDFLAGS_vmlinux	+= -Map=vmlinux.map
+endif
+
 # Align the bit size of userspace programs with the kernel
 KBUILD_USERCFLAGS  += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))
 KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))
@@ -1461,7 +1465,7 @@ endif # CONFIG_MODULES
 # make distclean Remove editor backup files, patch leftover files and the like
 
 # Directories & files removed with 'make clean'
-CLEAN_FILES += include/ksym vmlinux.symvers \
+CLEAN_FILES += include/ksym vmlinux.symvers vmlinux.map \
 	       modules.builtin modules.builtin.modinfo modules.nsdeps \
 	       compile_commands.json
 
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d7a7bc3b6098..1ac4234ad879 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -363,6 +363,19 @@ config SECTION_MISMATCH_WARN_ONLY
 
 	  If unsure, say Y.
 
+config SAVE_LINK_MAP
+	bool "Save vmlinux link map file(s)"
+	default n
+	help
+	  If you say Y here, vmlinux link map will be saved into
+	  vmlinux.map. The link map is quite useful during making kernel
+	  changes related to how the kernel is composed and linker
+	  scripts debugging.
+
+	  In addition to that architectures supporting compressed kernel
+	  images might also produce arch/*/boot/compressed/vmlinux.map
+	  for the decompressor code as well.
+
 config DEBUG_FORCE_FUNCTION_ALIGN_32B
 	bool "Force all function address 32B aligned" if EXPERT
 	help
-- 
2.25.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ