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 0288CC433EF for ; Fri, 15 Apr 2022 21:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347918AbiDOVw4 (ORCPT ); Fri, 15 Apr 2022 17:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353560AbiDOVuz (ORCPT ); Fri, 15 Apr 2022 17:50:55 -0400 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CC52463BC1 for ; Fri, 15 Apr 2022 14:48:22 -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 23FLfkDN003040; Fri, 15 Apr 2022 16:41:46 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 23FLfj8o003038; Fri, 15 Apr 2022 16:41:45 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Fri, 15 Apr 2022 16:41:45 -0500 From: Segher Boessenkool To: Fangrui Song Cc: Nick Desaulniers , hjl.tools@gmail.com, Peter Zijlstra , x86@kernel.org, Josh Poimboeuf , mbenes@suse.cz, rostedt@goodmis.org, linux-toolchains@vger.kernel.org Subject: Re: The trouble with __weak and objtool got worse Message-ID: <20220415214145.GD25951@gate.crashing.org> References: <20220415182229.GB25951@gate.crashing.org> <20220415200714.GC25951@gate.crashing.org> <20220415211740.qju2brynn7uyxdg7@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220415211740.qju2brynn7uyxdg7@google.com> User-Agent: Mutt/1.4.2.3i Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org On Fri, Apr 15, 2022 at 02:17:40PM -0700, Fangrui Song wrote: > On 2022-04-15, Nick Desaulniers wrote: > >>> Uh, the email says -- prefix, but reality shows a single prefix? What > >>> happened there? Maybe that link is to an earlier version than what > >>> landed? > >> > >>Neither has landed. You get the -g option, which can take options of > >>itself, parsed by the target or file format code. "as -gobbledygook" > >>works fine as well :-) > > > >https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1408485ce69f844dcd7ded093a8 > >Looks like it's been in binutils since 2.36 (IIUC the ChangeLog correctly). > > (Came to this thread from https://reviews.llvm.org/D123874) > > H.J.'s patch discards unused STT_SECTION symbols. Yup, it doesn't add any command line option, it is an internals patch. > The ability to add back such symbols > (--generate-unused-section-symbols={yes|no}) is not in binutils. > Neither 2.36 nor master branch has > --generate-unused-section-symbols={yes|no}. Which is a good thing really, it is a horrible option name. > as -generate-unused-section-symbols=yes is just a GNU as quirk that it > interprets nearly all -g* options as -g, which generates .debug_arange > and .debug_info compile units. As -gdwarf-2 in fact, for most ELF targets (specific targets can override it still, although hopefully they don't :-) ) > The feature is very different from > restoring STT_SECTION symbols. > > I know little about the kernel requirement but I think it shouldn't be > too difficult to teach a relocatable object file consumer to not assume > existence of STT_SECTION. The converse (add the feature to GNU as and > LLVM integrated assembler) would be much more unideal. Yeah, there are sections already (those *are* required in ELF), so objtool should just use those, instead of relying on coincidences that were true in old tools versions, but were never guaranteed :-) Segher