Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1696632rwd; Sun, 28 May 2023 00:33:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5PPzf+9tBs02lWOIwRaY2BY7EELU2CfI791NR3AY9mGkJiF3Zd1aQCjAPcyp8/KxdlU6C0 X-Received: by 2002:a05:6a20:6a03:b0:110:9b0b:71a5 with SMTP id p3-20020a056a206a0300b001109b0b71a5mr2670142pzk.23.1685259219617; Sun, 28 May 2023 00:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685259219; cv=none; d=google.com; s=arc-20160816; b=Z5cQF2ntactvXrQ/cRyW2u3EvpFKBQBgNul6/G64x3p0pInwCYXyOUuQGY+iDn7KHc 3nrhr8vMMONwBjYywQXCYj3MaNpyuvv1FLX9w/2ZD3k6E4vubX6tbNhiutBIOwmcDbJs ucKyzASRuP5b3qPiWn7X815zS5KNMhUFldRPvLEGut9rD1Rn0vhngErq9uzrbYiddMDo Nu2xZeT9nE7J1Bn/3zpPpJm69GP/zrCNidCNGJ0KU6jJZSUT2vBJ/FO+7OvHoL5w+G52 nbrm/hvXCNH6lJqEkaX3f2TnqKZWs3Bc2OGzyHIl018+XFPZKCJiCO8h535oXKBqmYCF gZXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=gP3nFfNK5j3vavu826+K+OtUh+zqDIeFHcx+U064wFA=; b=s8YLseDiPhTBnnFeRtsP6ZICbjB/KTJnTSaI9gPq3GZiNA1Nm70RgvOsC3BtICF2lB YvSw9btBb2XWh4njb7SKHGu/k+Zfp0S7LDPbbspXrqgniLe11OzoRAIGQmJ44hXjg+Hz w7ZhX10QReL4dlnpOVti1nMtveXIIA5VYxv0MZUF01IXult1kmT4oejysqal2AytGWhD jVlWOyJGAls4u1e6DdBIk6BFnLESnOFklVR3dQb2Clkrao3HmQzO9NipxpUJwgHSA/aO wHPKPMji4W7pXEtW6NDQCSrXlLY5441DRecxtU+vXz5X56AMtG1d9Htm6iWC5GsCyzbH pLag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ckh3SPGt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 19-20020a631753000000b0053592069d66si7341237pgx.467.2023.05.28.00.33.24; Sun, 28 May 2023 00:33:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ckh3SPGt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229487AbjE1HaX (ORCPT + 99 others); Sun, 28 May 2023 03:30:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjE1HaV (ORCPT ); Sun, 28 May 2023 03:30:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE4E3D9; Sun, 28 May 2023 00:30:20 -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 72C5360E9E; Sun, 28 May 2023 07:30:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D943BC433D2; Sun, 28 May 2023 07:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685259019; bh=oGy/fpG9JCLiydgHe4qcscmOq33gjRh/dp/hY2T5fDM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Ckh3SPGtTbB1cW25lV0oYSLn5B7ee3A8v1cJSjpi9CQC9vt8eCR7xCE0CPQW/7evT sZW6HBxUEfidm+KJerIB0tQQAq4omyE1DIjyUPbCUWuIpPZfnlwM9qSTMb15mDN6l2 qHgkFf2RRomQAAA8IEUfAY+OdeKqQlDn89bcXxeRf9p3Pm8QD7hHY+bXALO59WWXU8 ptlbWFojGvWwpAARFzrf6zgZ8iG8HIXt19zJlysmjvmWdbLuO8f4nyRJTJV5O+HHdl OeB9F1JzJMDrMpOJd89Z03cSSIrnevNmBNq1TYLOYhv7JGe1Mkm8YptGBrjg+io6vY M95/2AluusXJg== Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-6af8127031cso938388a34.2; Sun, 28 May 2023 00:30:19 -0700 (PDT) X-Gm-Message-State: AC+VfDw8nhp/6zrnBDdNBQXjVTzEUIFdMkiEdHGXVlW9Tm6rp8NT9YEJ wpUxK11547/IbD8O8cbQS/DUQGLFF3FJbKoxN0s= X-Received: by 2002:a05:6870:3842:b0:19e:c953:d854 with SMTP id z2-20020a056870384200b0019ec953d854mr2724186oal.52.1685259019161; Sun, 28 May 2023 00:30:19 -0700 (PDT) MIME-Version: 1.0 References: <20230521160426.1881124-1-masahiroy@kernel.org> <20230521160426.1881124-21-masahiroy@kernel.org> In-Reply-To: From: Masahiro Yamada Date: Sun, 28 May 2023 16:29:42 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 20/20] modpost: show offset from symbol for section mismatch warnings To: Nick Desaulniers Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Nathan Chancellor , Nicolas Schier Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 26, 2023 at 3:27=E2=80=AFAM Nick Desaulniers wrote: > > On Sun, May 21, 2023 at 9:05=E2=80=AFAM Masahiro Yamada wrote: > > > > 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); > > Is the cast necessary if you use the %p format specifier instead of 0x%x? No. faddr and from->st_value are offsets from the start of the section. They are not pointers. %p does not make sense. > > > > > if (mismatch->mismatch =3D=3D EXTABLE_TO_NON_TEXT) { > > if (match(tosec, mismatch->bad_tosec)) > > -- > > 2.39.2 > > > > > -- > Thanks, > ~Nick Desaulniers --=20 Best Regards Masahiro Yamada