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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 584F7C433F5 for ; Sat, 16 Apr 2022 13:27:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232057AbiDPNaR (ORCPT ); Sat, 16 Apr 2022 09:30:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230237AbiDPNaQ (ORCPT ); Sat, 16 Apr 2022 09:30:16 -0400 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6B23A89310 for ; Sat, 16 Apr 2022 06:27:44 -0700 (PDT) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 23GDK83i009656; Sat, 16 Apr 2022 08:20:08 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 23GDK7co009653; Sat, 16 Apr 2022 08:20:07 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sat, 16 Apr 2022 08:20:06 -0500 From: Segher Boessenkool To: Peter Zijlstra Cc: x86@kernel.org, Josh Poimboeuf , hjl.tools@gmail.com, ndesaulniers@google.com, mbenes@suse.cz, rostedt@goodmis.org, linux-toolchains@vger.kernel.org Subject: Re: The trouble with __weak and objtool got worse Message-ID: <20220416132005.GE25951@gate.crashing.org> References: <20220415182229.GB25951@gate.crashing.org> <20220416105905.GE2731@worktop.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220416105905.GE2731@worktop.programming.kicks-ass.net> User-Agent: Mutt/1.4.2.3i Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org On Sat, Apr 16, 2022 at 12:59:05PM +0200, Peter Zijlstra wrote: > On Fri, Apr 15, 2022 at 01:22:29PM -0500, Segher Boessenkool wrote: > > On Fri, Apr 15, 2022 at 01:19:04PM +0200, Peter Zijlstra wrote: > > [ huge snip ] > > > > > This seems to happen when objtool cannot find a section symbol, in which > > > case it falls back to any other symbol to key off of, however in this > > > case that goes terribly wrong! > > > > That is an objtool problem then. Fix objtool so it looks at symbols > > directly? > > I'm not sure what you're saying. So sorry. "So that it looks at *sections* directly", I meant to say. > > > The other option seems to be to have objtool add section symbols it > > > needs, however due to ELF being a total PITA and requiring all LOCAL > > > symbols to be before GLOBAL symbols, this would mean re-ordering the > > > whole symbol table (I have the code somewhere :-/). > > > > ELF requires no such thing? Where do you see this? > > The first google hit: > > https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-79797.html > > which has: > > "In each symbol table, all symbols with STB_LOCAL binding precede the > weak symbols and global symbols. As Sections describes, a symbol table > section's sh_info section header member holds the symbol table index for > the first non-local symbol." That is not the ELF spec, and it is incorrect afaics. Do you have any authorative reference? > I ran into that when I violated that contraint at some point and > the various elf tools screamed at me. Huh. Can you show anything that reproduces that? Segher