From patchwork Sun May 21 16:04:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13249447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64A00C7EE2A for ; Sun, 21 May 2023 16:06:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231166AbjEUQGi (ORCPT ); Sun, 21 May 2023 12:06:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231174AbjEUQGS (ORCPT ); Sun, 21 May 2023 12:06:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DAB0E78; Sun, 21 May 2023 09:05:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E23BC6179A; Sun, 21 May 2023 16:05:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1114CC4339E; Sun, 21 May 2023 16:05:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684685148; bh=OsDQm9j1PsDhPRuAGeNz8Ube9RFsdeDF2EBPrRh3R00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pSSCKgO/pgmJMYhG5PbEkacPkJY9fJzSjVvsy7mQ6g5XQ01mmRjzRWa0l5QGox1zj Ehse+zJR2r2fCka79ORaDKzj6yVqM5mxK7nXB4Kv/aOXj3iuPLmiBVlzi3wQnkvh/K gl7fj2T9p82yk3Ae/afrvt+jPkYL4dORCwGu1sQa6VhK6y2wsrh5ynhBLLselJ3+Hg jjvrrEfABBLm2CwQ3RWulT3jXzttTWAZ0621MtACF9jyf36m5f6j1yw+WT6t0JU0hl kFHtBhfwGzWb6VLUk9dRfAQCYUN+ISXdzTa2HcU74FcvIx0wsCB04D+sGcjAF+lh0S n+VHiBIAn+Y0w== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Masahiro Yamada Subject: [PATCH v6 19/20] modpost: merge two similar section mismatch warnings Date: Mon, 22 May 2023 01:04:24 +0900 Message-Id: <20230521160426.1881124-20-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230521160426.1881124-1-masahiroy@kernel.org> References: <20230521160426.1881124-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org In case of section mismatch, modpost shows slightly different messages. For extable section mismatch: "%s(%s+0x%lx): Section mismatch in reference to the %s:%s\n" For the other cases: "%s: section mismatch in reference: %s (section: %s) -> %s (section: %s)\n" They are similar. Merge them. Signed-off-by: Masahiro Yamada Reviewed-by: Nick Desaulniers --- scripts/mod/modpost.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 852cc164c77e..e7561fa57478 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1135,21 +1135,10 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, sec_mismatch_count++; - switch (mismatch->mismatch) { - case TEXT_TO_ANY_INIT: - case DATA_TO_ANY_INIT: - case TEXTDATA_TO_ANY_EXIT: - case XXXINIT_TO_SOME_INIT: - case XXXEXIT_TO_SOME_EXIT: - case ANY_INIT_TO_ANY_EXIT: - case ANY_EXIT_TO_ANY_INIT: - warn("%s: section mismatch in reference: %s (section: %s) -> %s (section: %s)\n", - modname, fromsym, fromsec, tosym, tosec); - break; - case EXTABLE_TO_NON_TEXT: - warn("%s(%s+0x%lx): Section mismatch in reference to the %s:%s\n", - modname, fromsec, (long)faddr, tosec, tosym); + warn("%s: section mismatch in reference: %s (section: %s) -> %s (section: %s)\n", + modname, fromsym, fromsec, tosym, tosec); + if (mismatch->mismatch == EXTABLE_TO_NON_TEXT) { if (match(tosec, mismatch->bad_tosec)) fatal("The relocation at %s+0x%lx references\n" "section \"%s\" which is black-listed.\n" @@ -1169,7 +1158,6 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, else error("%s+0x%lx references non-executable section '%s'\n", fromsec, (long)faddr, tosec); - break; } }