From patchwork Sun May 21 16:04:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13249452 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 E8B62C77B73 for ; Sun, 21 May 2023 16:07:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230340AbjEUQHa (ORCPT ); Sun, 21 May 2023 12:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230487AbjEUQHP (ORCPT ); Sun, 21 May 2023 12:07:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1ACC10C9; Sun, 21 May 2023 09:06:50 -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 E5DAB6150E; Sun, 21 May 2023 16:05:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5F73C4339C; Sun, 21 May 2023 16:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684685150; bh=yLNmLqnZjiVDJ1+11bIdJ/9gglrLgGpnva7MS4wZCMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fuQmkKOb2ikon5r/q2qXFOV5oTZZS8XMuVYB/PsHRLP7PCSsjM0E+NeEa8UivuKmQ CnAxtt76X6Q5icdBf97JfxWVKmhiQro5JfTBzKP2CRasqalW6XLq3aR9SYOWg4cyX6 yrBimkCoAp3F31cJyfcQ+jW4ODLwBsH3e3VtpModseDbwsb5tjVLF2tZH6tk1v/b0q TqBVYxIe8uD5mbHSSv4cGsuFW1HaskwvAayHj8FTZPINe9MpmF30qq6HqhG04xuRUd pT58HZ9HRiqwxb5t/9a8cKQC4OHDk0uZRAhfja7MaFwYQyea7MhCcvO9/XTL78tzU7 p/ar05SiIS3tw== 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 20/20] modpost: show offset from symbol for section mismatch warnings Date: Mon, 22 May 2023 01:04:25 +0900 Message-Id: <20230521160426.1881124-21-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 Currently, modpost only shows the symbol names and section names, so it repeats the same message if there are multiple relocations in the same symbol. It is common the relocation spans across multiple instructions. It is better to show the offset from the symbol. Signed-off-by: Masahiro Yamada --- scripts/mod/modpost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index e7561fa57478..4da96746a03b 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1135,8 +1135,8 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, sec_mismatch_count++; - warn("%s: section mismatch in reference: %s (section: %s) -> %s (section: %s)\n", - modname, fromsym, fromsec, tosym, tosec); + warn("%s: section mismatch in reference: %s+0x%x (section: %s) -> %s (section: %s)\n", + modname, fromsym, (unsigned int)(faddr - from->st_value), fromsec, tosym, tosec); if (mismatch->mismatch == EXTABLE_TO_NON_TEXT) { if (match(tosec, mismatch->bad_tosec))