From patchwork Thu Oct 3 10:29:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 175072 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp109060ill; Thu, 3 Oct 2019 03:30:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwi88J/GYMcYl5nF1vAxv0noIkrtvIZVoOTleHYfeZm9ARHJfrbUTKdbWSnKIOxF3ubeP/s X-Received: by 2002:a17:906:19d9:: with SMTP id h25mr7036722ejd.43.1570098615830; Thu, 03 Oct 2019 03:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570098615; cv=none; d=google.com; s=arc-20160816; b=Im7dcG7kn3w2kbzZjZwPloKx5JVpxdygYo4+P2nCnNd5znkWd478jaE+lP2h/BCg5M p1Fitq8OWysxCOYNx08TBfO8fF/rRs89zBpi0a5dXZUOhDBh85e70hD+Kat7OEx8iRzK ZUpw1kVnEwMVmyDaaW1GkXyIkJIVYTKGwkVC0ZtG9y+GgHFWsLQEJApeu1aS0z1jKccO 8TERoH/MzvVA04UIleWHRZ7MhvW/Ko1VSpFBAnvP0yETz8urCFCuurZUCR/zQAHaTFEg HcPne+dPGXJdTJu58qFmz6iD2PuOaHwRmplQSvhb6j7LbvkmvlXsHKp1t3w5oKgMY/NH +fNQ== 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=pMnHQORs2NGZ3n4d6znGdbIAOnjr2/F3UzN5iG+hjIQ=; b=t1cUNeJ8GDhDMh+7kWMDVgwcZAhaQGSKTSne1rQNPrlb6H6ul2YrzJqI4ElDqy0cmW xhzavFK1lfM1Z/2Q6CVwwxxKu8gmyeMiaHvZgR6NQbAbKJ3jjJw2HaRdV3zBlpcUOlap DC7GPVXer/1mDuZmpR/G1QYSIH2I9csGrewU7tI3x5d+C9XoFUHHGSHizQYBn71EvIx+ 3oaiOu2Jyq0428NB/1c/D+pmI+MFH8VLSybXLLCsnBvTj2h5YEr3mji9m4RAjGyWfOK9 aXnZGQ7DvQ/x68SRMFHOy8N+3kpaEAfSlvVs9SP+gyqb0RjZBcuczLtxSRF6lU5L3mni EVVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=if8kKidK; 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 d27si1200240ede.381.2019.10.03.03.30.15; Thu, 03 Oct 2019 03:30:15 -0700 (PDT) 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=if8kKidK; 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 S1729316AbfJCKaM (ORCPT + 27 others); Thu, 3 Oct 2019 06:30:12 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:49390 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725827AbfJCKaM (ORCPT ); Thu, 3 Oct 2019 06:30:12 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id x93ATIYu014338; Thu, 3 Oct 2019 19:29:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x93ATIYu014338 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1570098559; bh=pMnHQORs2NGZ3n4d6znGdbIAOnjr2/F3UzN5iG+hjIQ=; h=From:To:Cc:Subject:Date:From; b=if8kKidKQ1gQ+bVFAZ1Cvyf9TwWp30f3uYtC1RTDZvuEIwwPX5/y6B/4iuLUpOb7+ 7IyZj1Y/2IjnSvPy/9e6IRK6tj8m2Ji30mJaFxB/mbSpNma5TvuE5yhELJdRxOp2G0 H2OtCblY2Sr+d6hGJJkXQAd4zPrlLOiHKnC9qoDpZv+kNYETy5scLlF8PHoSiW0XK6 /GZ7kjbOq/135juWsjnfDZo3byz850TlKdjPMdyd3JMcNz91um1a97y0vLk1HU5FGE W7/TN/u9i5+TekSKMhKEWOgUQyX58WoO2pGJiXS0YGCiTOTwK0ndBazZqdL1/w88eh bqLc6UYlLHYlQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Masahiro Yamada , Jonathan Corbet , Michal Marek , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] kbuild: two minor updates for Documentation/kbuild/modules.rst Date: Thu, 3 Oct 2019 19:29:12 +0900 Message-Id: <20191003102915.28301-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Capitalize the first word in the sentence. Use obj-m instead of obj-y. obj-y still works, but we have no built-in objects in external module builds. So, obj-m is better IMHO. Signed-off-by: Masahiro Yamada --- Documentation/kbuild/modules.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/Documentation/kbuild/modules.rst b/Documentation/kbuild/modules.rst index d2ae799237fd..dd1d2a0688e8 100644 --- a/Documentation/kbuild/modules.rst +++ b/Documentation/kbuild/modules.rst @@ -501,7 +501,7 @@ build. --- 6.3 Symbols From Another External Module Sometimes, an external module uses exported symbols from - another external module. kbuild needs to have full knowledge of + another external module. Kbuild needs to have full knowledge of all symbols to avoid spitting out warnings about undefined symbols. Three solutions exist for this situation. @@ -521,7 +521,7 @@ build. The top-level kbuild file would then look like:: #./Kbuild (or ./Makefile): - obj-y := foo/ bar/ + obj-m := foo/ bar/ And executing:: From patchwork Thu Oct 3 10:29:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 175071 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp108876ill; Thu, 3 Oct 2019 03:30:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyEKbqE+kusK3djhK37JBGMS4GjDxsFEMwiKutK4E5LafhflCineaFwpJBQVSGIBKVt+zMW X-Received: by 2002:a17:906:a2c9:: with SMTP id by9mr6912857ejb.29.1570098605937; Thu, 03 Oct 2019 03:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570098605; cv=none; d=google.com; s=arc-20160816; b=YCUM+nGisrVSTdAVPDmqarCRKtfwhmFmEfWx4rWG5Z56ifiJJ6IN45xpTsw9fucjxT PV/rwLSJ7DTHXcncbLcRMx4bN+NrsPx9WHLVyPT0ptFFOYwpOzOedN2hYyo3A2q6HqXX xRMUSNwqr1FEk+3cMpbsII0YS2M+W//L36rPsoBLNDoYaNBnTSj4Bh2/NfmO49JHHGCJ Dc7Gu/+L169nakYsgI2sU7amWH5AGbSIoGeBjWnyWBb4I2hyGbMBOUeC2aR0kHxmtsEF OZoFKVb5Ea42aD+sweZXgMBEkxR+qb2KQKnwqXMuMT9D5vT5p5KEy4NlGSGMZhhLfYZk G4tQ== 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=kZnR29A01CLRY6YuzVibGJ8V77kkHRFaE8m/+CQ4ZTk=; b=gkUlZY/B1HvrNmLY4XdiCFQVD9cnhwKaM4Fwli+XvdoCsLzSCtNJJPq1H5rc7kjfkW D4/cDqAjgErqLfMEP/JQvB7Hs2M6a6ntd4NFL1hx8MfV8cDNb7mDuPqs8oXte+hIryo2 otIscvv0s6xVYLG2kFM3jKMWKEQpSP6aSYOnL+49VYENtPoKHdb/2UzEunQ5CdeRmtFB vP4DJam6TFqhJpWwO2gF1cI+TEsUBmWmJzO1+i7qRtceqsJGBomGyX6yjc8ZG7bO3b+a DBUFMI8TnBzP/4nw1qTFNkGY0bEx7xFlDBaOnMLzMwbtmUVQZoQOKFmZ7eUzGN2/WEcj 5zCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=SXDG6Dv4; 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 o17si956261ejm.261.2019.10.03.03.30.05; Thu, 03 Oct 2019 03:30:05 -0700 (PDT) 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=SXDG6Dv4; 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 S1728955AbfJCKaE (ORCPT + 27 others); Thu, 3 Oct 2019 06:30:04 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:49078 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725827AbfJCKaB (ORCPT ); Thu, 3 Oct 2019 06:30:01 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id x93ATIYv014338; Thu, 3 Oct 2019 19:29:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x93ATIYv014338 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1570098560; bh=kZnR29A01CLRY6YuzVibGJ8V77kkHRFaE8m/+CQ4ZTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SXDG6Dv44hCsS46cxrD2S2SKZlWCtlieKaq3f0eDh+o/a+geZJH2eh7MB2/2aVIWn UKxdsz9rmKjs5EAdCquwLC2eYxQEaTXJ6gFNah021tj6EGmcyjSiZRjUYYcQDCkT50 AuzlIoRR80caoeOpU2FLFxl21sWrTARnUFTtbEXCNGz2ukJsyrURoaBf+kpTfiTSrF CoW/H6AOjBZaAOs8Rmqs4QLN42iW7FE8ZU1n6Z6iGqmckaDLZ3mCPzj6vWZlcq+VYk efhf4+rJj/AQENDwxgaqMlIuC4R1gU3lXh8au+sU59aK9urF9hexKjYE5vyfc4LS6n wziuxA8b3fSMw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 2/4] modpost: do not parse vmlinux for external module builds Date: Thu, 3 Oct 2019 19:29:13 +0900 Message-Id: <20191003102915.28301-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191003102915.28301-1-yamada.masahiro@socionext.com> References: <20191003102915.28301-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When building external modules, $(objtree)/Module.symvers is scanned for symbol information of vmlinux and in-tree modules. Additionally, vmlinux is parsed if it exists in $(objtree)/. This is totally redundant since all the necessary information is contained in $(objtree)/Module.symvers. Do not parse vmlinux at all for external module builds. This makes sense because vmlinux is deleted by 'make clean'. 'make clean' leaves all the build artifacts for building external modules. vmlinux is unneeded for that. Signed-off-by: Masahiro Yamada --- scripts/Makefile.modpost | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 952fff485546..72109d201196 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -67,8 +67,12 @@ __modpost: else +MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T - + +ifeq ($(KBUILD_EXTMOD),) +MODPOST += $(wildcard vmlinux) +else # When building external modules load the Kbuild file to retrieve EXTRA_SYMBOLS info -ifneq ($(KBUILD_EXTMOD),) # set src + obj - they may be used when building the .mod.c file obj := $(KBUILD_EXTMOD) @@ -79,8 +83,6 @@ include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \ $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile) endif -MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T - $(wildcard vmlinux) - # find all modules listed in modules.order modules := $(sort $(shell cat $(MODORDER))) From patchwork Thu Oct 3 10:29:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 175073 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp109065ill; Thu, 3 Oct 2019 03:30:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXH203be0SHUy3Tx2HFBIVwMSL2RzGAf29NY8KklFSFBuMp1jXijuMt3Ar3Xr0aG4ZGsNL X-Received: by 2002:aa7:d9d5:: with SMTP id v21mr8617193eds.106.1570098616280; Thu, 03 Oct 2019 03:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570098616; cv=none; d=google.com; s=arc-20160816; b=dhVUY8DFVCBFWyWT6AT59PiJYjrONccqyN+cUCvebQxOACM3gE1zkHuhz4LDfoD0P8 GdajFq3yb2wzcE77fSRj4v9PnrttlNsyby3VoKBEmOXrRd/GPLMAyCWdXEmk3dGdpPzT +C3hsE4exxM0Gs0N/OCcyvcvb6eM/1uZP5w5hsZ4HYQfVVhhnoEOt7vPKyqL/imSyZF8 5WMfpUijd5vBwvhNLsNU8sbf14caDbutDWTrTxIutblu8RWlx4MG4iBQEAQGvIkM6EYL k7Xk+kqZYhEOs39Jcq8N3qyvOXE5Rk4tSErlNXqloX4/2BLhU02XcbsQ4lzFrN80faZN hn7w== 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=DlfvIJ7TNPo8SCZtpXZn6EtbMqn7kWyCU+GUqdyLtYI=; b=ZFVhHJFyMZQ1WEmr33HxihbsCrh+IwBN8kALRgGDsPD7te1QUC3+hi8iZG2BtCD9a5 EWUjdHCdrGOqebq4g6onk1Yp4EJp1GkFDbxDyVS5Wufi9CzPlEKKPp0eaz3ghV6Tgc90 +DbzESju0akAkAgxnQ/o9PmUTrkdok5AtLG+4a5mCVR5d4XGySVgsBT6YZiWwxaM9W3C khG7F6LCN8GsG1yLi5ZdAoTr/Xi2ORPx5bVtwxILcWL328T6me9123bLm6rM5bD/M1nU OKvrrZjSybg7FZVKsrkQTNwVxLlWTVVvWTdahs4fd9bcxz554bN/bJXGLT4VR88Rkn3i zavw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=DUtb3Alp; 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 d27si1200240ede.381.2019.10.03.03.30.16; Thu, 03 Oct 2019 03:30:16 -0700 (PDT) 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=DUtb3Alp; 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 S1729378AbfJCKaP (ORCPT + 27 others); Thu, 3 Oct 2019 06:30:15 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:49391 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728919AbfJCKaN (ORCPT ); Thu, 3 Oct 2019 06:30:13 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id x93ATIYw014338; Thu, 3 Oct 2019 19:29:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x93ATIYw014338 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1570098560; bh=DlfvIJ7TNPo8SCZtpXZn6EtbMqn7kWyCU+GUqdyLtYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DUtb3Alp1sqmTbsP8jUWlNMigWaAp8UWUZX/l65EB596ArVof+HMPAU3TiEdtu5Qf riXr60YjvdXoAnjnk5t4tFgmYLYyH70x5Oz3VUyd1RM/pnUfq3RfqXRmsTWosSBrHy uAcUMFdP60EIpT/et8LeV2D5OIat/gcQMloznmkzTQQBcMHdryGSXSfVGjKLCurLgx PrZxnks5kgeVl/cuCqpzJeA40XYuB8UzdDsUDHyi0pmiCOyyqtLHqyyMaGfaa36NBz lgwv/um1AUfO0jZZ8gkq21Ep0wgDyb9CyKPbMnl1xNclgtJ6CTHnfchU+XtvfPqVmh 2iKj+twhd7rdw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Masahiro Yamada , Jonathan Corbet , Michal Marek , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] kbuild: do not read $(KBUILD_EXTMOD)/Module.symvers Date: Thu, 3 Oct 2019 19:29:14 +0900 Message-Id: <20191003102915.28301-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191003102915.28301-1-yamada.masahiro@socionext.com> References: <20191003102915.28301-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit 040fcc819a2e ("kbuild: improved modversioning support for external modules"), the external module build reads Module.symvers in the directory of the module itself, then dumps symbols back into it. It accumulates stale symbols in the file when you build an external module incrementally. The idea behind it was, as the commit log explained, you can copy Modules.symvers from one module to another when you need to pass symbol information between two modules. However, the manual copy of the file sounds questionable to me, and containing stale symbols is a downside. Some time later, commit 0d96fb20b7ed ("kbuild: Add new Kbuild variable KBUILD_EXTRA_SYMBOLS") introduced a saner approach. So, this commit removes the former one. Going forward, the external module build dumps symbols into Module.symvers to be carried via KBUILD_EXTRA_SYMBOLS, but never reads it automatically. With the -I option removed, there is no one to set the external_module flag unless KBUILD_EXTRA_SYMBOLS is passed. Now the -i option does it instead. Signed-off-by: Masahiro Yamada --- Documentation/kbuild/modules.rst | 13 +++++-------- scripts/Makefile.modpost | 1 - scripts/mod/modpost.c | 9 ++------- 3 files changed, 7 insertions(+), 16 deletions(-) -- 2.17.1 diff --git a/Documentation/kbuild/modules.rst b/Documentation/kbuild/modules.rst index dd1d2a0688e8..4c74f683bb2b 100644 --- a/Documentation/kbuild/modules.rst +++ b/Documentation/kbuild/modules.rst @@ -492,18 +492,15 @@ build. to the symbols from the kernel to check if all external symbols are defined. This is done in the MODPOST step. modpost obtains the symbols by reading Module.symvers from the kernel source - tree. If a Module.symvers file is present in the directory - where the external module is being built, this file will be - read too. During the MODPOST step, a new Module.symvers file - will be written containing all exported symbols that were not - defined in the kernel. + tree. During the MODPOST step, a new Module.symvers file will be + written containing all exported symbols from that external module. --- 6.3 Symbols From Another External Module Sometimes, an external module uses exported symbols from another external module. Kbuild needs to have full knowledge of all symbols to avoid spitting out warnings about undefined - symbols. Three solutions exist for this situation. + symbols. Two solutions exist for this situation. NOTE: The method with a top-level kbuild file is recommended but may be impractical in certain situations. @@ -543,8 +540,8 @@ build. all symbols defined and not part of the kernel. Use "make" variable KBUILD_EXTRA_SYMBOLS - If it is impractical to copy Module.symvers from - another module, you can assign a space separated list + If it is impractical to add a top-level kbuild file, + you can assign a space separated list of files to KBUILD_EXTRA_SYMBOLS in your build file. These files will be loaded by modpost during the initialization of its symbol tables. diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 72109d201196..01c0a992d293 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -50,7 +50,6 @@ MODPOST = scripts/mod/modpost \ $(if $(CONFIG_MODVERSIONS),-m) \ $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \ $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ - $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),$(addprefix -e ,$(KBUILD_EXTRA_SYMBOLS))) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \ diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 936d3ad23c83..5234555cf550 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -2540,7 +2540,7 @@ int main(int argc, char **argv) { struct module *mod; struct buffer buf = { }; - char *kernel_read = NULL, *module_read = NULL; + char *kernel_read = NULL; char *dump_write = NULL, *files_source = NULL; int opt; int err; @@ -2548,13 +2548,10 @@ int main(int argc, char **argv) struct ext_sym_list *extsym_iter; struct ext_sym_list *extsym_start = NULL; - while ((opt = getopt(argc, argv, "i:I:e:mnsT:o:awEd")) != -1) { + while ((opt = getopt(argc, argv, "i:e:mnsT:o:awEd")) != -1) { switch (opt) { case 'i': kernel_read = optarg; - break; - case 'I': - module_read = optarg; external_module = 1; break; case 'e': @@ -2599,8 +2596,6 @@ int main(int argc, char **argv) if (kernel_read) read_dump(kernel_read, 1); - if (module_read) - read_dump(module_read, 0); while (extsym_start) { read_dump(extsym_start->file, 0); extsym_iter = extsym_start->next; From patchwork Thu Oct 3 10:29:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 175070 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp108862ill; Thu, 3 Oct 2019 03:30:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdkw1eR82FM/sZzbGdhR0pE2Eu37ChlYPL+XzxndJKg85EB5kTCK/EwvHh9KAb7H3yD8ux X-Received: by 2002:a50:8a9a:: with SMTP id j26mr8694454edj.251.1570098605549; Thu, 03 Oct 2019 03:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570098605; cv=none; d=google.com; s=arc-20160816; b=XBfzK+42l1GN6SD9B9irps0xqKfS6szO9cCYu4gmoR86NQVwDNHP11cSbPrhWMA8pS S+2YZJnw/0JTcGxFy4vgRGAP6g7k8mNE99rzMmY7Iv5uN8Uyog9VV/vlZIUEKXqiQzS5 bPXINNRuTtgoPxOToNJShGkRO7P5lvf36HIi6ITik3fPwkz5aZItFdhgJbvO9o7D1a7d kOOZu45o8kF0sbxZCHwFvV2hwNVASkexkQepYl2i77hCTHNI1Bg8NsmRPiDY0OmSU+8o U79IZ1rvHCiUQuE++uixQjV0JBx7t7f0Ood5pE+liMq4Y5X92MTnsSp0xZUezHUWGkRp np1Q== 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=97NLJz+Obv3dJt7wwiAspNiro8fFokgiiEuk+kW1mrM=; b=har9BhZQiv8lCkTr8WXAhmCVsh6NHGx01QHDio3Smf8OSbkcat0DvC8hxXYBdetLrr LS03O8VBKDseNBaiu4dIl0eA/aemZarWtLZDLsLLGZgoQHWN5zefW0nnPLud+xVqngbd nrsAONbjtxy8354/zb2gUQaEwWaV6VJ7TmXpG9kyv6gxJLALasbLeiBlu8gSsjrFRVlG 43X3gVj8NqY9AozLhH9c5ZpDly+ql97K6cg0tC3STtzQ8ic1CXOH2fc7W3ZKpO1Cfj+F 77vxacvptic4QLmDDmt5Px7ZqEffDNIILil2GKmKR28aXJw6/zA+f1sUM+/F2Wuy2/BS DLaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=dxL2Hgd7; 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 o17si956261ejm.261.2019.10.03.03.30.05; Thu, 03 Oct 2019 03:30:05 -0700 (PDT) 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=dxL2Hgd7; 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 S1728608AbfJCKaB (ORCPT + 27 others); Thu, 3 Oct 2019 06:30:01 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:49077 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727368AbfJCKaB (ORCPT ); Thu, 3 Oct 2019 06:30:01 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id x93ATIYx014338; Thu, 3 Oct 2019 19:29:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x93ATIYx014338 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1570098561; bh=97NLJz+Obv3dJt7wwiAspNiro8fFokgiiEuk+kW1mrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dxL2Hgd7ThRlxe/hAyXRFVAIYJ7pIzTmj07XGOoFExkh7GsWFYfB1wqczggmwEWwy qnn4C8CgaUrtwnFspwyaj9jvMlZkfB2ocMhSQPdctSHENydAQ/R3q8uCmoECR4eRcP CIhcDNel3A8N6ngxz9pa/z4HLLm/uVUKE10iL5V4FWdU3HnVCSYAhhFoQzXbR7UZTa FXTvrKcekNT98MvNve0hrlBnSqCQ2PPbjQGuPIXkChdzLhjDQ4VzsZBoYdOWPtZyPM vcqYKF+eQyzuj6L2G8DhVQXev7LI2D2mOCH0Zglx8cdU/g9n2Js1gqz74zWV8KL5qS YrZv51rQxHpag== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 4/4] modpost: do not set ->preloaded for symbols from Module.symvers Date: Thu, 3 Oct 2019 19:29:15 +0900 Message-Id: <20191003102915.28301-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191003102915.28301-1-yamada.masahiro@socionext.com> References: <20191003102915.28301-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that there is no overwrap between symbols from ELF files and ones from Module.symvers. So, the 'exported twice' warning should be reported irrespective of where the symbol in question came from. Only the exceptional case is when __crc_ symbol appears before __ksymtab_. This typically occurs for EXPORT_SYMBOL in .S files. Signed-off-by: Masahiro Yamada --- scripts/mod/modpost.c | 1 - 1 file changed, 1 deletion(-) -- 2.17.1 diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 5234555cf550..6ca38d10efc5 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -2457,7 +2457,6 @@ static void read_dump(const char *fname, unsigned int kernel) s = sym_add_exported(symname, namespace, mod, export_no(export)); s->kernel = kernel; - s->preloaded = 1; s->is_static = 0; sym_update_crc(symname, mod, crc, export_no(export)); }