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 47C9DC433F5 for ; Fri, 15 Apr 2022 15:15:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245063AbiDOPSE (ORCPT ); Fri, 15 Apr 2022 11:18:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233750AbiDOPSE (ORCPT ); Fri, 15 Apr 2022 11:18:04 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D5CD08AE46 for ; Fri, 15 Apr 2022 08:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650035734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Z66E5jras70cqM22xtgxfZLxlAaDhrPamnl55wKmwUw=; b=TVObVHOHePBJwV0gBbDeosrDpFz5JM3O7LnJPIS+O5j8NF9wVWwm/XqHYo/dm8SfaGjPJp ArQALjiS5IS1iB6teEsIEx2GWUIwzYLArIyFsBQKY5pOzgFubg7qEzhvPArn2mE3qUMITW 4tZAR5cFM8dVOPh+IMsAV8D8K8/vShU= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-164-Fjmd3El8Mpyky83BiiujkA-1; Fri, 15 Apr 2022 11:15:33 -0400 X-MC-Unique: Fjmd3El8Mpyky83BiiujkA-1 Received: by mail-qt1-f197.google.com with SMTP id b22-20020ac84f16000000b002ef8943051eso5444562qte.0 for ; Fri, 15 Apr 2022 08:15:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Z66E5jras70cqM22xtgxfZLxlAaDhrPamnl55wKmwUw=; b=R3WcUCfAwKMxFJFp9ivIX2PxwS3kJAXvCiCjPWyWAwHL35rzFtux9LRWrjF5DCyXz0 WTja4xKhDzF0uEQLaluOPnFPzhFrqe2EIsLMYpDuUujDjlVRBJV5vXxviNjD0CSIcePx /6rURZFhO+fRslcpei1t6WbJVyhXKqQzOI2fNLIfH98fEewfl0/an0tZmmgXUrtDfZEx 6gOJZ6l5N+lSwJZbQeTEw1M+XYm8ZtmtaH1A88+BAzRZy0+UogxILp+n7hXzK30YZU3N V5Z1gFbkH1odf3o6MCH05m7nAhUmSYdippCiTMgk3l4IWZHbCvY/EbycI17d0CvhtfRZ qunA== X-Gm-Message-State: AOAM530DaPxbOYJdYD39xkZIS4gDj2DXhk8l9ghNv6d1NwEBtmDlhDUq KRtpoVnPhpjXrqdwm0cno2pfrlRW45auqVuOLxPLDF553WeABbwZl1sPxbMsW/wnmpC8N/alJQV 3lM7IoQqR9QzL8p0S0++YW9aW8vn+9w== X-Received: by 2002:a05:622a:2294:b0:2f1:ccd6:2221 with SMTP id ay20-20020a05622a229400b002f1ccd62221mr5697367qtb.453.1650035733040; Fri, 15 Apr 2022 08:15:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4EBmwWxvRZ0gULwM9r9U1/iVvnn3AW9WWN+j1rqJtrL2WFfQQky/3WciI/7/q01XRY5ogXA== X-Received: by 2002:a05:622a:2294:b0:2f1:ccd6:2221 with SMTP id ay20-20020a05622a229400b002f1ccd62221mr5697352qtb.453.1650035732777; Fri, 15 Apr 2022 08:15:32 -0700 (PDT) Received: from treble ([2600:1700:6e32:6c00::45]) by smtp.gmail.com with ESMTPSA id g71-20020a379d4a000000b0069a029c7659sm2649230qke.35.2022.04.15.08.15.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 08:15:32 -0700 (PDT) Date: Fri, 15 Apr 2022 08:15:29 -0700 From: Josh Poimboeuf To: Peter Zijlstra Cc: x86@kernel.org, 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: <20220415151529.esh5m42nj3oexoff@treble> References: <20220415151014.dv4bougij3tqvozp@treble> MIME-Version: 1.0 In-Reply-To: <20220415151014.dv4bougij3tqvozp@treble> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jpoimboe@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org On Fri, Apr 15, 2022 at 08:10:18AM -0700, Josh Poimboeuf wrote: > On Fri, Apr 15, 2022 at 01:19:04PM +0200, Peter Zijlstra wrote: > > Now, if we do IBT/LTO builds, and run objtool on linked objects only, > > this obvious doesn't happen, because the weak stuff has been resolved by > > then. But ideally we'd not force that since it has a build time > > penalty.. > > > > 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 :-/). > > > > Alternatively: > > > > https://sourceware.org/pipermail/binutils/2020-December/114671.html > > > > seems to suggest: -Wa,--generate-unused-section-symbols=yes, ought to > > work, except I'm getting: > > > > $ gcc -O2 -fcf-protection=none -fno-asynchronous-unwind-tables -Wa,--generate-unused-section-symbols=yes -c foo*.c > > as: unrecognized option '--generate-unused-section-symbols=yes' > > as: unrecognized option '--generate-unused-section-symbols=yes' > > > > $ as --version > > GNU assembler (GNU Binutils for Debian) 2.38 > > Can we trick the assembler into creating function symbols for all the I meant s/function symbols/section symbols/ obviously. > static call sites by having some inline asm (or _THIS_IP_) in the static > call macro with a dummy reference to a code location in the function? -- Josh