From patchwork Mon Jan 14 03:27:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 155407 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3200265jaa; Sun, 13 Jan 2019 19:28:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN6o/Deqs1xud7ABfaAQ3ohUf6xkRK8/GVvak4dxl+a4pi9uJGhsdvOc1sWEaUjlCIlOmote X-Received: by 2002:a17:902:2887:: with SMTP id f7mr23133347plb.176.1547436531764; Sun, 13 Jan 2019 19:28:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547436531; cv=none; d=google.com; s=arc-20160816; b=KQFNG4q0McyH4plyLr/0v0X5FXo0FNpvMIzd9DiWXx+VjSHhJZENiLn3/Kt1zUgstc GGoOcCV06Bnw4X291WbC4jteTUxzSwMmwMhba5PV7yIyZ+uI4G6vu18eX850UbpjT+/e rAZScoCTPUdWBqBhbsMWPQIJGs02lv9LFuQ6qEtU0jKJE0n1fv+KfScZiPZPz8fd/7U7 G5Cs5z4jKWtAqJTxFgnPp2GjuWzyk3+zdMlgq5M5i4hO1rtKdtYqvQ1Bq2vgdzXe7tJR axMqrf/1hq3QZsbKpUrlcP76YzBP5v0G1VHZZCTQKV9moMI+rqf5+Y6tnQJ5neFjvGUh pcKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=qBY8DqCSiZ8zeu0VY5+SCHZidy9aU5aOT28YOxmXrxw=; b=l4V21kEJPq9nMhwTjbmYQgPyLr+FeyhrRBoJqpzQ/IU2tsQRF3ISyHckoMtNwuzT3r OmP9QL0s4gNNpndO/dtDrlwmskY6xBkZMeiJtjHsk6Xp5jF33b2UQbbJbSnnz7FKyxii 3cE5NMTIQWLgnzyzZzjU7EMacOtSX7f1ZZ/5dlBKjLpIMK9VEUw+sWX5Y4ckRozexdDW 5OtGccBbvqV7WTMml7qCAjl2d5TYGHaKqisqnLN0rDm/tHaY+7lXUDSEE5tj+zU6pCsI ymMnHuQhOszfStlViO/DWdOPWwYUv28ZuMIwRgZ2gfWHJiHyArrlLul0D8CLK0H7ncO7 OjgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="hW55NC/j"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si8867036plb.234.2019.01.13.19.28.51; Sun, 13 Jan 2019 19:28:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="hW55NC/j"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726756AbfAND2u (ORCPT + 31 others); Sun, 13 Jan 2019 22:28:50 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:34177 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726699AbfAND2u (ORCPT ); Sun, 13 Jan 2019 22:28:50 -0500 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-07.nifty.com with ESMTP id x0E3S96R029303; Mon, 14 Jan 2019 12:28:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x0E3S96R029303 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1547436490; bh=qBY8DqCSiZ8zeu0VY5+SCHZidy9aU5aOT28YOxmXrxw=; h=From:To:Cc:Subject:Date:From; b=hW55NC/jn52zyUAcez9Kaii1G0wf2M8i5T2xOpd107MON3JM7b463JmcuAPnLpABC QnDYTCvdfBdwdzK1fF96rFZGW/doZMLQ1a+s8N7hrSb/H03NWe9cWSgj+g4IqBhlX6 /LwBf4bbf28ED0M+6D2/sYIo+irOSBOIxvmke0ndaP28/Yzj/0ky5Kb2x1x6QOpInj OTcv/RzYynYfx9G2zKaQlqgupNgv/fqloXAjvJT6TB8QI8EJi8PgxL3dJNih3sQpKp x41or7wgstjG1Niufnowxy7854Tc3aIokxmrc9t0zsHlA/nunZ4rJHFPp652g8hi2F 2Rnjx5vWe/wYg== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicholas Piggin , Stephen Rothwell , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] kbuild: remove top-level built-in.a Date: Mon, 14 Jan 2019 12:27:58 +0900 Message-Id: <1547436479-10491-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The symbol table in the final archive is unneeded because it is passed to the linker after the --whole-archive option. Every object file in the archive is included in the link anyway. Pass thin archives from subdirectories directly to the linker, and remove the final archiving step. Signed-off-by: Masahiro Yamada --- scripts/link-vmlinux.sh | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) -- 2.7.4 Acked-by: Nicholas Piggin diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index c8cf453..4788def 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -44,24 +44,6 @@ info() fi } -# Thin archive build here makes a final archive with symbol table and indexes -# from vmlinux objects INIT and MAIN, which can be used as input to linker. -# KBUILD_VMLINUX_LIBS archives should already have symbol table and indexes -# added. -# -# Traditional incremental style of link does not require this step -# -# built-in.a output file -# -archive_builtin() -{ - info AR built-in.a - rm -f built-in.a; - ${AR} rcsTP${KBUILD_ARFLAGS} built-in.a \ - ${KBUILD_VMLINUX_INIT} \ - ${KBUILD_VMLINUX_MAIN} -} - # Link of vmlinux.o used for section mismatch analysis # ${1} output file modpost_link() @@ -69,7 +51,8 @@ modpost_link() local objects objects="--whole-archive \ - built-in.a \ + ${KBUILD_VMLINUX_INIT} \ + ${KBUILD_VMLINUX_MAIN} \ --no-whole-archive \ --start-group \ ${KBUILD_VMLINUX_LIBS} \ @@ -88,7 +71,8 @@ vmlinux_link() if [ "${SRCARCH}" != "um" ]; then objects="--whole-archive \ - built-in.a \ + ${KBUILD_VMLINUX_INIT} \ + ${KBUILD_VMLINUX_MAIN} \ --no-whole-archive \ --start-group \ ${KBUILD_VMLINUX_LIBS} \ @@ -99,7 +83,8 @@ vmlinux_link() -T ${lds} ${objects} else objects="-Wl,--whole-archive \ - built-in.a \ + ${KBUILD_VMLINUX_INIT} \ + ${KBUILD_VMLINUX_MAIN} \ -Wl,--no-whole-archive \ -Wl,--start-group \ ${KBUILD_VMLINUX_LIBS} \ @@ -160,7 +145,6 @@ cleanup() rm -f .tmp_System.map rm -f .tmp_kallsyms* rm -f .tmp_vmlinux* - rm -f built-in.a rm -f System.map rm -f vmlinux rm -f vmlinux.o @@ -217,8 +201,6 @@ fi; # final build of init/ ${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init -archive_builtin - #link vmlinux.o info LD vmlinux.o modpost_link vmlinux.o From patchwork Mon Jan 14 03:27:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 155408 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3200302jaa; Sun, 13 Jan 2019 19:28:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN6rSSi7bQmUnLktSVc2qmUhIAtNGxsSBfXYER79CBkkKYtTX0CyILA1N2HtTyOi1YKGuBlS X-Received: by 2002:a63:cf48:: with SMTP id b8mr21776307pgj.17.1547436535504; Sun, 13 Jan 2019 19:28:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547436535; cv=none; d=google.com; s=arc-20160816; b=mEN6BQusdrJJi0JNwCSvQ2AqF43X0Kd6w8zNbvUAUXNS6SabINEUqYmf7m0e9zse6K u1eoDOLyfrmzIANXWDGMnhSDeKZ4gCS+Ad+SYqIqEuonQDRM6Hi6mRf6DTmfTldYQ6k8 eBQMp1tc5xoYE/ogbtjEhxzgJ+9wMwKpeLLwPuln3wmcSYd5LPTPocqEJvcoAN6WKlQe 60NuNk8p/AMGqw7BJ6vE9HS6lvCQMw9r8l9OBWssmw/YYJrekxs35mDYxfZcBud5biy1 IqjEwpm9AAPHnL2mi1knt7o9m0uUQ0h2wMaCT0pEcWHzlMzjqV8oefrPfwK8jd/VnyRh LOpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=s/3mCKfgXz9syY3gRwtXC4jZgLZsJr7G5HuVD6z088c=; b=Sw+WVe23CilklxHxi1HqWsrEWb/aowg50LabTtB9zuNKOaOGyHkZfwPktsSBU3cJjc H2nAqV31pfWvEJcikGLzzTtZLqWbSxXG3+Z3CVktKJwGkQAhdEEUX9kQjBJxJw1vjoBf BGrSPfsB9h/SnoTHY6j1DpJ1IjmSM/5yLwHKyt3pXyQ5VctpB8X+vCVlMSXBlhWn4ejJ sVMHOZILT4JvnfH4f3YiRLJnLtYZIAb8l5pDBw7d3EovuAdlqMUAdvgSDzv9cvyKpidx pcCesEK/H2UE6/8XJnLvdHpbc9gE8GqWMK/GzqdnyUfaPWSnFZD7UXa8zx3war7zcuv3 MFeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=daBCP+Au; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 90si29700942plb.17.2019.01.13.19.28.55; Sun, 13 Jan 2019 19:28:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=daBCP+Au; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726771AbfAND2y (ORCPT + 31 others); Sun, 13 Jan 2019 22:28:54 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:34178 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726709AbfAND2u (ORCPT ); Sun, 13 Jan 2019 22:28:50 -0500 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-07.nifty.com with ESMTP id x0E3S96S029303; Mon, 14 Jan 2019 12:28:10 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x0E3S96S029303 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1547436490; bh=s/3mCKfgXz9syY3gRwtXC4jZgLZsJr7G5HuVD6z088c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=daBCP+Auc7UR4wB+IdOUdH9wyz4MATTUmVVD/XQuRc0GEtGYUx7WpSgy7uQWBLdhb 8T5x2nEnfA/gQwLHMBHPhzjZ8xZ5RlxUefYICdeGuuTkYRLjiBbirwQkCJs1S5H98s aA1ztyZeyK1U9koVi1lk9u5keQraK1fofqojePCGsN3V2shzZDZ5esZxhkvkY4xINc v9cKSRyBP5MRwRnmBBuhfXlTHF3L9CdEfjbfobOxmZ6xEFk57xC2ADhSFtsBSIYvLQ oI334rY+IhLdiADyM6xZcrvgotndz4dZJeaUODUFsGUz6v+4wHIcN0BEx7Fg4fWpkI 2u898mTlwdF/w== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicholas Piggin , Stephen Rothwell , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] kbuild: merge KBUILD_VMLINUX_{INIT, MAIN} into KBUILD_VMLINUX_OBJS Date: Mon, 14 Jan 2019 12:27:59 +0900 Message-Id: <1547436479-10491-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547436479-10491-1-git-send-email-yamada.masahiro@socionext.com> References: <1547436479-10491-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The top Makefile does not need to export KBUILD_VMLINUX_INIT and KBUILD_VMLINUX_MAIN separately. Put every built-in.a into KBUILD_VMLINUX_OBJS. The order of $(head-y), $(init-y), $(core-y), ... is still retained. Signed-off-by: Masahiro Yamada --- Makefile | 6 +++--- scripts/link-vmlinux.sh | 28 ++++++++++------------------ 2 files changed, 13 insertions(+), 21 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 499b968..68898cc 100644 --- a/Makefile +++ b/Makefile @@ -975,15 +975,15 @@ libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y))) virt-y := $(patsubst %/, %/built-in.a, $(virt-y)) # Externally visible symbols (used by link-vmlinux.sh) -export KBUILD_VMLINUX_INIT := $(head-y) $(init-y) -export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y) +export KBUILD_VMLINUX_OBJS := $(head-y) $(init-y) $(core-y) $(libs-y2) \ + $(drivers-y) $(net-y) $(virt-y) export KBUILD_VMLINUX_LIBS := $(libs-y1) export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds export LDFLAGS_vmlinux # used by scripts/package/Makefile export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools) -vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS) +vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) # Recurse until adjust_autoksyms.sh is satisfied PHONY += autoksyms_recursive diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 4788def..bc7f1fc 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -3,22 +3,17 @@ # # link vmlinux # -# vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_INIT) and -# $(KBUILD_VMLINUX_MAIN) and $(KBUILD_VMLINUX_LIBS). Most are built-in.a files -# from top-level directories in the kernel tree, others are specified in -# arch/$(ARCH)/Makefile. Ordering when linking is important, and -# $(KBUILD_VMLINUX_INIT) must be first. $(KBUILD_VMLINUX_LIBS) are archives -# which are linked conditionally (not within --whole-archive), and do not -# require symbol indexes added. +# vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_OBJS) and +# $(KBUILD_VMLINUX_LIBS). Most are built-in.a files from top-level directories +# in the kernel tree, others are specified in arch/$(ARCH)/Makefile. +# $(KBUILD_VMLINUX_LIBS) are archives which are linked conditionally +# (not within --whole-archive), and do not require symbol indexes added. # # vmlinux # ^ # | -# +-< $(KBUILD_VMLINUX_INIT) -# | +--< init/version.o + more -# | -# +--< $(KBUILD_VMLINUX_MAIN) -# | +--< drivers/built-in.a mm/built-in.a + more +# +--< $(KBUILD_VMLINUX_OBJS) +# | +--< init/built-in.a drivers/built-in.a mm/built-in.a + more # | # +--< $(KBUILD_VMLINUX_LIBS) # | +--< lib/lib.a + more @@ -51,8 +46,7 @@ modpost_link() local objects objects="--whole-archive \ - ${KBUILD_VMLINUX_INIT} \ - ${KBUILD_VMLINUX_MAIN} \ + ${KBUILD_VMLINUX_OBJS} \ --no-whole-archive \ --start-group \ ${KBUILD_VMLINUX_LIBS} \ @@ -71,8 +65,7 @@ vmlinux_link() if [ "${SRCARCH}" != "um" ]; then objects="--whole-archive \ - ${KBUILD_VMLINUX_INIT} \ - ${KBUILD_VMLINUX_MAIN} \ + ${KBUILD_VMLINUX_OBJS} \ --no-whole-archive \ --start-group \ ${KBUILD_VMLINUX_LIBS} \ @@ -83,8 +76,7 @@ vmlinux_link() -T ${lds} ${objects} else objects="-Wl,--whole-archive \ - ${KBUILD_VMLINUX_INIT} \ - ${KBUILD_VMLINUX_MAIN} \ + ${KBUILD_VMLINUX_OBJS} \ -Wl,--no-whole-archive \ -Wl,--start-group \ ${KBUILD_VMLINUX_LIBS} \