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.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable 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 422DCC433DB for ; Mon, 15 Feb 2021 21:23:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E81CD64DFF for ; Mon, 15 Feb 2021 21:23:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbhBOVWz (ORCPT ); Mon, 15 Feb 2021 16:22:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:58456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229662AbhBOVWx (ORCPT ); Mon, 15 Feb 2021 16:22:53 -0500 Received: from gandalf.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 3449364DE0; Mon, 15 Feb 2021 21:22:11 +0000 (UTC) Date: Mon, 15 Feb 2021 16:22:09 -0500 From: Steven Rostedt To: Josh Poimboeuf Cc: Greg Kroah-Hartman , Nick Desaulniers , Xi Ruoyao , "# 3.4.x" , Arnd Bergmann , "Peter Zijlstra (Intel)" , Miroslav Benes , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , LKML , linux-tip-commits@vger.kernel.org Subject: Re: [tip: objtool/urgent] objtool: Fix seg fault with Clang non-section symbols Message-ID: <20210215162209.5e2a475b@gandalf.local.home> In-Reply-To: <20210215155806.bjcouvmkapj4pa4y@treble> References: <20210212170750.y7xtitigfqzpchqd@treble> <20210212124547.1dcf067e@gandalf.local.home> <20210213091304.2dd51e5f@oasis.local.home> <20210213155203.lehuegwc3h42nebs@treble> <20210214155147.3owdimqv2lyhu6by@treble> <20210215095307.6f5fb12f@gandalf.local.home> <20210215155806.bjcouvmkapj4pa4y@treble> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 15 Feb 2021 09:58:06 -0600 Josh Poimboeuf wrote: > On Mon, Feb 15, 2021 at 09:53:07AM -0500, Steven Rostedt wrote: > > On Sun, 14 Feb 2021 09:51:47 -0600 > > Josh Poimboeuf wrote: > > > > > Steve, looks like recordmcount avoids referencing weak symbols directly > > > by their function symbol. Maybe it can just skip weak symbols which > > > don't have a section symbol, since this seems like a rare scenario. > > > > When does the .text.unlikely section disappear? During the creation of the > > object, or later in the linker stage? > > The section is there, but the symbol associated with the section > (".text.unlikely" symbol) isn't generated by the assembler. > Greg, Does this fix the issue with you? It appears to fix it for my arch linux VM that I created that uses binutils 2.36-3. -- Steve diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h index f9b19524da11..558b67f8364e 100644 --- a/scripts/recordmcount.h +++ b/scripts/recordmcount.h @@ -562,7 +562,7 @@ static char const * __has_rel_mcount(Elf_Shdr const *const relhdr, /* reltype */ if (w(txthdr->sh_type) != SHT_PROGBITS || !(_w(txthdr->sh_flags) & SHF_EXECINSTR)) return NULL; - return txtname; + return shdr0->sh_size ? txtname : NULL; } static char const *has_rel_mcount(Elf_Shdr const *const relhdr,