From patchwork Tue Oct 2 22:59:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Kliegman X-Patchwork-Id: 1539521 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 8790C40B1E for ; Tue, 2 Oct 2012 23:00:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755194Ab2JBW7p (ORCPT ); Tue, 2 Oct 2012 18:59:45 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:44777 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755141Ab2JBW7m (ORCPT ); Tue, 2 Oct 2012 18:59:42 -0400 Received: by ieak13 with SMTP id k13so15972388iea.19 for ; Tue, 02 Oct 2012 15:59:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:x-mailer; bh=j4MovjCVBJIdvAx2dk7D7xyo3ZueKH2AU0fnZfedjw8=; b=I3MG0o//+FIZ96gG5MDjdFQxyQeGbF3AxNAe/ngPdryOjgJSH4iPZPp2ZX94CDP5Rf iznZw82A0+2WJQr1ouzPnei3G7qXOPjBdsO/9NDNnOt+BGJUsPle4bOl2LCc8FMOkxw8 Nh34hl6os6IeNtvvNgdzuUKcoVNO25/8ZmqWE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=j4MovjCVBJIdvAx2dk7D7xyo3ZueKH2AU0fnZfedjw8=; b=oumj3JQwE1Abc5xpyiOFdoNtwLvygDgRCUU9AUjOzfvL34ZpFA8mTbqQF4mkkB5at+ e4gf/56507UawPj9AR/wm11qOVVaptZDjK9Gfa90YWIH3/G7BBNw4yenkq+qawNvHhwj Z89nqhCmJv+9Lu3zL9j6b19G0xuPP8x7DPZtyGXBWPUjwrlijEOm70d9vA+5MrpmivzA SgPH475BidsSG2lhvpSuFGXF7RqYnL4kVg8y0wpAJK+zrCTY7llPstj01F+jEcPYayip 1gn0r0M8Mf+PTcXtK3dqA4yOPLhEknnXNjG4VXfyFfX5/6FrBMkAdSj45llcaNyeQpMG Ygeg== Received: by 10.50.5.133 with SMTP id s5mr180554igs.49.1349218781742; Tue, 02 Oct 2012 15:59:41 -0700 (PDT) Received: from kliegs-chrome.wat.corp.google.com (kliegs-chrome.wat.corp.google.com [172.23.176.30]) by mx.google.com with ESMTPS id gz10sm1931563igc.9.2012.10.02.15.59.40 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 02 Oct 2012 15:59:41 -0700 (PDT) From: Jonathan Kliegman To: linux-kbuild@vger.kernel.org Cc: Jonathan Kliegman Subject: [PATCH] modpost: Add flag -f for making section mismatches fatal Date: Tue, 2 Oct 2012 18:59:31 -0400 Message-Id: <1349218771-1854-1-git-send-email-kliegs@chromium.org> X-Mailer: git-send-email 1.7.7.3 X-Gm-Message-State: ALoCoQmRJjNbSebJNyYGA2ORk/UL0ZeW6RRYq0T6k+0M0KE8jzyFLdFSC4P/LGMTPP1lIIu9Akp6 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The section mismatch warning can be easy to miss during the kernel build process. Allow it to be marked as fatal to be easily caught and prevent mismatches from slipping in. Signed-off-by: Jonathan Kliegman --- scripts/Makefile.modpost | 1 + scripts/mod/modpost.c | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index a1cb022..1e496d3 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -81,6 +81,7 @@ modpost = scripts/mod/modpost \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ + $(if $(CONFIG_SECTION_MISMATCH_FATAL),,-f) \ $(if $(cross_build),-c) quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 68e9f5e..679e364 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -42,6 +42,7 @@ static int warn_unresolved = 0; /* How a symbol is exported */ static int sec_mismatch_count = 0; static int sec_mismatch_verbose = 1; +static int sec_mismatch_fatal = 0; enum export { export_plain, export_unused, export_gpl, @@ -2127,7 +2128,7 @@ 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:cmsSo:awM:K:")) != -1) { + while ((opt = getopt(argc, argv, "i:I:e:cmsSo:awM:K:f")) != -1) { switch (opt) { case 'i': kernel_read = optarg; @@ -2165,6 +2166,9 @@ int main(int argc, char **argv) case 'w': warn_unresolved = 1; break; + case 'f': + sec_mismatch_fatal = 1; + break; default: exit(1); } @@ -2211,14 +2215,20 @@ int main(int argc, char **argv) sprintf(fname, "%s.mod.c", mod->name); write_if_changed(&buf, fname); } - if (dump_write) write_dump(dump_write); - if (sec_mismatch_count && !sec_mismatch_verbose) - warn("modpost: Found %d section mismatch(es).\n" - "To see full details build your kernel with:\n" - "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", - sec_mismatch_count); + if (sec_mismatch_count) { + if (!sec_mismatch_verbose) { + warn("modpost: Found %d section mismatch(es).\n" + "To see full details build your kernel with:\n" + "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", + sec_mismatch_count); + } + if (sec_mismatch_fatal) { + fatal("modpost: Section mismatches detected.\n" + "Unset CONFIG_SECTION_MISMATCH_FATAL to allow them.\n"); + } + } return err; }