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=-9.0 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 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 DD4F6C47082 for ; Mon, 7 Jun 2021 15:42:33 +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 9F42A61029 for ; Mon, 7 Jun 2021 15:42:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F42A61029 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.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:In-Reply-To:MIME-Version:References: 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=dsND2UJF20e8zhJsrIxRq3RWl2fY+MtfgZU7o4kPGEQ=; b=FhZ9d3TYooYHlT qsenGhYqJPgbZA99EbyKgMA3LcFQWxONQNoGZhz4yT4llyps5CQESflG2e+cqGEjkLv8bbL5ONWW3 GFrMlFMOIS0TKo9aO4D4g6xhb+LFN2S7wEvKDlM2/4UaT9KCM3xZ2REhosv0LhnbzTD/1jmAZixpy MncHLJxP8zQ4Y8at+EZfJTDAFB4TIM/nCSpLdAgFHly5v3VbSGO1uSL6nt0RAj5cJbxqb/gkuVk48 u3yBkWrevZ4/8CrQvXzedo2/L0S5EuJw+5EYb8Bfc/Gt7+gdR+v3mJhoeeDHy0Vg+iujx5Odlg9Rh Si4RRCDFZWGwFuwsEInQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqHMg-004Ihu-CQ; Mon, 07 Jun 2021 15:40:34 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqHMe-004IhK-9z; Mon, 07 Jun 2021 15:40:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=F13xOnM5F0Ufs2TOCg78ImeKaTi/MppD+Ee/8+ZOVI8=; b=P529/dNw+gMsYw/hfuMVAoBCZp ROKU97uFOlzFU6oKNahA9xz/5nFZSMQP5EHsm5/e22V+QmLx57Y4AobtI/h3WFwElZfw/N8ITwxhl t5jabZ/6vbWvAvEb3x48iqorZj9Fhvc+D//RL/1vah+pZ8bxlZ43SJrCQKlNNsCl1LMWbaPr6MSzb ux5T/zJULURJ5LWCjiB0eZwU4fP3XSK30JwHeOCXT5DJlrB0+2lH8JdXZKRVEYgNyDFoONRWNiGFY uJvDzD7E3dSz3VF5dMKzVcP8pg34INJdmmI2uLDRGkPTWUccRVFc0MCDR+5M0FknIUxy5iFDyxoP/ AVwrnxEA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lqHMK-00FxAA-6M; Mon, 07 Jun 2021 15:40:16 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 8A91E3001E3; Mon, 7 Jun 2021 17:40:11 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 774F82D6A737A; Mon, 7 Jun 2021 17:40:11 +0200 (CEST) Date: Mon, 7 Jun 2021 17:40:11 +0200 From: Peter Zijlstra To: Ard Biesheuvel Cc: 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 , "Steven Rostedt (VMware)" , Sami Tolvanen , yj.chiang@mediatek.com Subject: Re: [PATCH] recordmcount: avoid using ABS symbol as reference Message-ID: References: <20210607074258.32322-1-mark-pk.tsai@mediatek.com> <20210607080626.32612-1-mark-pk.tsai@mediatek.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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, Jun 07, 2021 at 01:44:21PM +0200, Peter Zijlstra wrote: > 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. > Apparently I'm consistently bad at spelling SHM_UNDEF today.. > 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