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 44311C433F5 for ; Fri, 15 Apr 2022 15:10:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354855AbiDOPMu (ORCPT ); Fri, 15 Apr 2022 11:12:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237460AbiDOPMu (ORCPT ); Fri, 15 Apr 2022 11:12:50 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8F4C98AE47 for ; Fri, 15 Apr 2022 08:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650035420; 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=Rtct397eS2hJa4S/W+3956TMlc2siums6ZFBGiME6NM=; b=SHkjQTo0ni5KH5IJSz67iMPRyFkVvz2vj9m1qSm4dQkBFeqZABTCTo6N+m4simxoD+Qt5V RJ4g27PTcaXMZKsHYdEBK8jmaIhm4CNDU49uen4oERw3PtXQaWi3l/7vCQzLvUVRtVkMPA 8MAx1A7b8uzORauFoUdDXVzvzfCJKRU= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-79-jCGumZpXNMSpyrMSi9okGg-1; Fri, 15 Apr 2022 11:10:19 -0400 X-MC-Unique: jCGumZpXNMSpyrMSi9okGg-1 Received: by mail-qt1-f200.google.com with SMTP id z3-20020ac86b83000000b002ed0f18c23cso5370275qts.17 for ; Fri, 15 Apr 2022 08:10:19 -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=Rtct397eS2hJa4S/W+3956TMlc2siums6ZFBGiME6NM=; b=FwwWt5ZPYO67bxNwHrbIxv8aqtxI7AtjdSuAd6rQC6jp8T7yAYTAZzNZb5pruYRQ1R 4/+kbtqs39b1mEr4ukZ3tP2TFYlUaayNOvg9rYRISqrASTTuL/fDld5/vKQOPRQJ8Fhc SOte5vF5GsL3A2+o5wMcgdDEp/eoiMFwV6cnzMD6O/MS/s4tjLuKnRJwg4g4r2yVZawl Y5njc/fNiX3eYRF3c/tWHUshvbo5PC8fGbxGJVNV03n4NEzqV9l3ilb4qvwDujOP/NNH OqFpY9HOBn9OUeDUN99bhPS/nsZnjnQTa0XcXWY7p+H6pJ6OPWD6GsAAjhqldSMm3ePh tcBw== X-Gm-Message-State: AOAM533++I+1jczfFjiAaPxL+4Ft008Bo9/UjQjvBsu52RwNlwDsX1MV M9Iz5dl12iTnWuUT0DMNbRWB+a8KXWhiP9dgGnora+lTBASwhnGNZT+rblmNFHVXhaR81YDRcGe BRSbx0PQn6Fz/iNP5P2aK20oxPIvW+w== X-Received: by 2002:a05:622a:446:b0:2e1:b95e:3b48 with SMTP id o6-20020a05622a044600b002e1b95e3b48mr5628682qtx.310.1650035418463; Fri, 15 Apr 2022 08:10:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1ZYuZwbOW+RkdJPRkHVd58QLC09GABTamzqcA1vMrEfCTzs80HK5xiFD6WF5pT0TtPRXNJQ== X-Received: by 2002:a05:622a:446:b0:2e1:b95e:3b48 with SMTP id o6-20020a05622a044600b002e1b95e3b48mr5628658qtx.310.1650035418171; Fri, 15 Apr 2022 08:10:18 -0700 (PDT) Received: from treble ([2600:1700:6e32:6c00::45]) by smtp.gmail.com with ESMTPSA id x20-20020ac85f14000000b002e1ee1c56c3sm2965234qta.76.2022.04.15.08.10.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 08:10:17 -0700 (PDT) Date: Fri, 15 Apr 2022 08:10:14 -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: <20220415151014.dv4bougij3tqvozp@treble> References: MIME-Version: 1.0 In-Reply-To: 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 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 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