From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37DE7C47082 for ; Mon, 7 Jun 2021 13:46:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D40C360FE9 for ; Mon, 7 Jun 2021 13:46:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D40C360FE9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JwAYrD0rfNSuNGaenYK09olLP2belngR2OHnp/miO+0=; b=OmXG0fZhB3tKXZ i5fqv7yAYp5D4CB5+WeWcZ2XQcrIH9Y36TaWVil4iVScOdkzRNDL5e6JJsYdA1dKkR1TbsuQrKOsp P4GTZr4tjE65BFyXsKiLU/ZcwgSgYr/S2Ae0oSneqE4ENjOMlAqoLcjnLDvYnhWBM/ne6CAgRefT8 HIHrndplr8rDQUoJbvt664aQ3M+QGiTYabbtnSpQmEzXyG5FWGwtmSHwKP68gfA41tX5p266HZvul 3QDQResw3Bj5bxQ+4FVD1IjIRVQvS+xDuddXATecdq/JG8Gl8NxQ3GvyMuaKQ0iZpNitVB01rvlSz v2wNs1MMfrwLrCSYaDbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqFYb-003uHv-9O; Mon, 07 Jun 2021 13:44:45 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqFYS-003u8G-9b; Mon, 07 Jun 2021 13:44:40 +0000 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E2EBF61001; Mon, 7 Jun 2021 13:44:34 +0000 (UTC) Date: Mon, 7 Jun 2021 09:44:33 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: Ard Biesheuvel , Mark-PK Tsai , Linux Kbuild mailing list , linux-toolchains@vger.kernel.org, Linux ARM , Linux Kernel Mailing List , linux-mediatek@lists.infradead.org, Matthias Brugger , Matt Helsley , Sami Tolvanen , yj.chiang@mediatek.com Subject: Re: [PATCH] recordmcount: avoid using ABS symbol as reference Message-ID: <20210607094433.473100d9@oasis.local.home> In-Reply-To: References: <20210607074258.32322-1-mark-pk.tsai@mediatek.com> <20210607080626.32612-1-mark-pk.tsai@mediatek.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210607_064436_399246_EE1119A9 X-CRM114-Status: GOOD ( 25.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 7 Jun 2021 13:44:21 +0200 Peter Zijlstra wrote: > There's an extended section header index section for just that. And > recordmcount actually seems to use that as well. > > I can't seem to find enough of the thread to figure out what the actual > problem is though. The lore archive doesn't have anything prior to this > message. > > One should only use st_shndx when >SHN_UDEF and SHN_XINDEX, then use .symtab_shndx. > > Apparently you've found a case where neither is true? In that case > objtool seems to use shndx 0. A matching recordmcount patch would be > something like this. Mark-PK, Does the below patch fix it for you too (if you backport it to your kernel). I much rather have recordmcount match objtool, as one day the two will hopefully merge to one executable. -- Steve > > > diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h > index f9b19524da11..d99cc0aed6fe 100644 > --- a/scripts/recordmcount.h > +++ b/scripts/recordmcount.h > @@ -194,13 +194,18 @@ static unsigned int get_symindex(Elf_Sym const *sym, Elf32_Word const *symtab, > unsigned long offset; > int index; > > - if (sym->st_shndx != SHN_XINDEX) > + if (sym->st_shndx > SHN_UDEF && > + sym->st_shndx < SHN_LORESERVE) > return w2(sym->st_shndx); > > - offset = (unsigned long)sym - (unsigned long)symtab; > - index = offset / sizeof(*sym); > + if (sym->st_shndx == SHN_XINDEX) { > + offset = (unsigned long)sym - (unsigned long)symtab; > + index = offset / sizeof(*sym); > > - return w(symtab_shndx[index]); > + return w(symtab_shndx[index]); > + } > + > + return 0; > } > > static unsigned int get_shnum(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel