From patchwork Fri Oct 23 11:57:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Gorbik X-Patchwork-Id: 11852841 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B49A14B4 for ; Fri, 23 Oct 2020 11:57:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64E9E24248 for ; Fri, 23 Oct 2020 11:57:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="WRMWXkLA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S463263AbgJWL5z (ORCPT ); Fri, 23 Oct 2020 07:57:55 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:8264 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S463256AbgJWL5y (ORCPT ); Fri, 23 Oct 2020 07:57:54 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 09NBWSuX034691; Fri, 23 Oct 2020 07:57:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=LT5KTnR4j/7fTzgAt99b8mdtsV7TOV6pwj0UzaIUczQ=; b=WRMWXkLAYB3c38/4P/SjyYOWcaThHfsfWnDWTgad6jB+PFsue/aEh1BtHVgbWO2X1n1S EbeG4hP8LFViuutpIN0qdlCedls82PSf/NYIXnOy0iBwfEClK/wxZytkpxcyy7+ph8Md bUDJ+bJtLIWRBvRghu1Ea48bEdLy+go3Aee2r/j/fqJ4zsroGx5KEh0UlzkvBjmm/wwU gSOrgcLqv5XnMvcqdCLc6lEEI6fPoh0vzvMPh9jDPGPL9P7EWL4zABwabZBgK0Z/pIeJ erIhZ+6gq0VxC0QJmBQAagrrnMUmekPlBffmIOk6azF1wcaDX//Y0vY8kIaIw8xeBB0v eg== Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 34bseq94h9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Oct 2020 07:57:44 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 09NBltUG019861; Fri, 23 Oct 2020 11:57:42 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04fra.de.ibm.com with ESMTP id 347r88bcd7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Oct 2020 11:57:42 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 09NBveTt34603326 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Oct 2020 11:57:40 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4FF2F42041; Fri, 23 Oct 2020 11:57:40 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E444642042; Fri, 23 Oct 2020 11:57:39 +0000 (GMT) Received: from localhost (unknown [9.145.183.202]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 23 Oct 2020 11:57:39 +0000 (GMT) Date: Fri, 23 Oct 2020 13:57:38 +0200 From: Vasily Gorbik To: Masahiro Yamada Cc: Michal Marek , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH 1/2] kbuild: add config option to save link map file(s) Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Patchwork-Bot: notify X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.737 definitions=2020-10-23_04:2020-10-23,2020-10-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 priorityscore=1501 suspectscore=1 bulkscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010230078 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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 --- .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 From patchwork Fri Oct 23 11:57:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Gorbik X-Patchwork-Id: 11852839 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12BAF1580 for ; Fri, 23 Oct 2020 11:57:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1A1D24182 for ; Fri, 23 Oct 2020 11:57:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="gqFuJvNb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S463257AbgJWL5y (ORCPT ); Fri, 23 Oct 2020 07:57:54 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:14170 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409403AbgJWL5x (ORCPT ); Fri, 23 Oct 2020 07:57:53 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 09NBVwDt013591; Fri, 23 Oct 2020 07:57:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=d2KlYU6cPzpYXNGWOxxfZILRbEZAbRMnACZPiwWQW50=; b=gqFuJvNbgXhxkuhnsfsKcSd7/el1tLXHX1ORprJkn8WAwNCvac9ZNA161bZmoyymuVu9 O6EW3HdWQ7J3fmxmpcE784+VyE5V/hEAAiLtOuHJAKjPEKqw6JDL1ChCotF43X9yjkfv rILil+8G6f85ttRrydHcS0wFh+QgkC/eAp4GQ+FIV6yMOgrcF2siniG9thHRIFzzjYs6 1rGEBA5qGWECk+Bgm6xMSbeLOeT2sh4jxr32827YhRg5J+QkgkEnPBum6gRUgRzgnv5D wThpRug2kK/EPfxEvukMLqEDbvucEs9/lO422Q/3T6uHH9DnAdLiQg2gX+cRBW9kdnI2 Zg== Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 34buh5n9dj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Oct 2020 07:57:47 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 09NBlsPp032418; Fri, 23 Oct 2020 11:57:45 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06fra.de.ibm.com with ESMTP id 347qvhbde4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Oct 2020 11:57:45 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 09NBvhiU26345964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Oct 2020 11:57:43 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3CF7D4C046; Fri, 23 Oct 2020 11:57:43 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D4FB94C050; Fri, 23 Oct 2020 11:57:42 +0000 (GMT) Received: from localhost (unknown [9.145.183.202]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 23 Oct 2020 11:57:42 +0000 (GMT) Date: Fri, 23 Oct 2020 13:57:41 +0200 From: Vasily Gorbik To: Masahiro Yamada Cc: Michal Marek , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH 2/2] s390/decompressor: support link map saving Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Patchwork-Bot: notify X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.737 definitions=2020-10-23_04:2020-10-23,2020-10-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 clxscore=1015 impostorscore=0 mlxscore=0 suspectscore=2 adultscore=0 mlxlogscore=828 malwarescore=0 spamscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010230078 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Produce arch/s390/boot/compressed/vmlinux.map link map for the decompressor, when CONFIG_SAVE_LINK_MAP option is enabled. Signed-off-by: Vasily Gorbik --- arch/s390/boot/compressed/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile index b235ed95a3d8..859a5c7c9ca7 100644 --- a/arch/s390/boot/compressed/Makefile +++ b/arch/s390/boot/compressed/Makefile @@ -21,7 +21,9 @@ OBJCOPYFLAGS := OBJECTS := $(addprefix $(obj)/,$(obj-y)) -LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T +clean-files += vmlinux.map + +LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup $(if $(CONFIG_SAVE_LINK_MAP),-Map=$(obj)/vmlinux.map) -T $(obj)/vmlinux: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS) FORCE $(call if_changed,ld)