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 7C4E3C433EF for ; Sat, 16 Apr 2022 16:07:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232300AbiDPQKX (ORCPT ); Sat, 16 Apr 2022 12:10:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230108AbiDPQKW (ORCPT ); Sat, 16 Apr 2022 12:10:22 -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 9089B37033 for ; Sat, 16 Apr 2022 09:07:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650125268; 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=ygFHjusU5vVIgxwTuSPuzqVHkbPskMoNhTMRJVlo0kc=; b=g8tfN/TuW78ajNDBN5ePYACSytL6sjdVXSHyMqNW5xBU7Ru8mYeeBP8DRise2G5fk02H1K JSXOid2J0CoPYbooTWhAq/BuAdKSB8vw51OtzaueNhkBZqu3iPxUc6M+lG8CZggCsuZtQC 62wLttLdENIqT3RSURi02+jfgaqSJZk= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-324-0UHIqp1fPoGouxCxHojH7w-1; Sat, 16 Apr 2022 12:07:47 -0400 X-MC-Unique: 0UHIqp1fPoGouxCxHojH7w-1 Received: by mail-qv1-f71.google.com with SMTP id z12-20020a0ce60c000000b0044632eb79b3so4497528qvm.7 for ; Sat, 16 Apr 2022 09:07:47 -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=ygFHjusU5vVIgxwTuSPuzqVHkbPskMoNhTMRJVlo0kc=; b=NQ6AvZDLDvzYRUjClAMJjoiL8+Cue6rDnyKoMQGSm1cawqDkDh700IV/v6VOHXWF8m WII21ljUf0sjXQx580Mc/mXzEKwslplEKRq2F/4ZdkthrB8mgeKkzbTjJFRpvR8AoEJK NWjXAu/XJ57xP9I5+YynQC8Z5ywjLrs9ixgk+i0CN6wd7o2qefNFS8tcO0nISj57696F 6QM6WhwG8G4tb7XykKJKyAoYH77LMl/CbVY/SreQzSP73ZKxpU8KJQUtb3NY0WNyuuFM 8HI4y79fkz9AlvankNjCqRmJWD1o3Ygqt9qFC2NcVfC4/kmaQLs/My+SsVKdY2HiVHkn DQ2g== X-Gm-Message-State: AOAM530YyXYIbqDsyxwPZkzmsWoqTbKjrgxgsIyEfexOfE33sKvzXKt2 fIJBZfyJJefRJXv96x8jBx8cN1Rt4w62kjE4E4KU5Hw4q7UJCgReP5t/6bI5SM/8MH9OgXXt43g 7esLbPl/1resnjx6oYkBm9ryi1YqA3g== X-Received: by 2002:a37:657:0:b0:69e:7b77:3973 with SMTP id 84-20020a370657000000b0069e7b773973mr1159716qkg.298.1650125266821; Sat, 16 Apr 2022 09:07:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzghEJU1kF01A712yCjgkafh8IeNuahjzXNfG/n5mhzThe/gAiUQ40HYF9Gb3gbt4JTzVg5+w== X-Received: by 2002:a37:657:0:b0:69e:7b77:3973 with SMTP id 84-20020a370657000000b0069e7b773973mr1159701qkg.298.1650125266570; Sat, 16 Apr 2022 09:07:46 -0700 (PDT) Received: from treble ([2600:1700:6e32:6c00::45]) by smtp.gmail.com with ESMTPSA id c136-20020a379a8e000000b0069e5df9d953sm1999991qke.34.2022.04.16.09.07.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Apr 2022 09:07:45 -0700 (PDT) Date: Sat, 16 Apr 2022 09:07:42 -0700 From: Josh Poimboeuf To: Peter Zijlstra Cc: Nick Desaulniers , x86@kernel.org, hjl.tools@gmail.com, mbenes@suse.cz, rostedt@goodmis.org, linux-toolchains@vger.kernel.org, clang-built-linux Subject: Re: The trouble with __weak and objtool got worse Message-ID: <20220416160742.6g4nejji4xyrgpvp@treble> References: <20220415152633.GA2731@worktop.programming.kicks-ass.net> <20220415182130.iltk2uxnubeaa4nk@treble> <20220416104809.GC2731@worktop.programming.kicks-ass.net> MIME-Version: 1.0 In-Reply-To: <20220416104809.GC2731@worktop.programming.kicks-ass.net> 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 Sat, Apr 16, 2022 at 12:48:09PM +0200, Peter Zijlstra wrote: > This *might* work for static_call. But what about things like > .retpoline_sites? > > If we get an indirect inside the weak function and at > a different place inside the non-weak function, then we end up with two > patch sites in the non-weak function. > > And since all of that is compiler generated, we don't have anything to > stick anything in to alleviate trouble. > > (in fact, I didn't observe this with static_call, I just picked it for > the example because it was somewhat easier) Ok, right. And ORC entries will be broken. I found the ones below by disabling CONFIG_DEBUG_INFO and looking for "sym->bind == STB_WEAK" in the elf_add_reloc_to_insn() fallback. I guess objtool will need to bite the bullet and create section symbols. lib/clz_ctz.o: warning: objtool: .orc_unwind_ip+0x0: missing section symbol for reference to weak function text lib/clz_ctz.o: warning: objtool: .orc_unwind_ip+0x4: missing section symbol for reference to weak function text lib/clz_ctz.o: warning: objtool: .orc_unwind_ip+0x8: missing section symbol for reference to weak function text lib/clz_ctz.o: warning: objtool: .orc_unwind_ip+0xc: missing section symbol for reference to weak function text lib/clz_ctz.o: warning: objtool: .orc_unwind_ip+0x10: missing section symbol for reference to weak function text lib/clz_ctz.o: warning: objtool: .orc_unwind_ip+0x14: missing section symbol for reference to weak function text lib/iomap_copy.o: warning: objtool: .orc_unwind_ip+0x0: missing section symbol for reference to weak function text lib/iomap_copy.o: warning: objtool: .orc_unwind_ip+0x4: missing section symbol for reference to weak function text lib/iomap_copy.o: warning: objtool: .orc_unwind_ip+0x10: missing section symbol for reference to weak function text lib/iomap_copy.o: warning: objtool: .orc_unwind_ip+0x14: missing section symbol for reference to weak function text lib/crc32.o: warning: objtool: .orc_unwind_ip+0x14: missing section symbol for reference to weak function text lib/crc32.o: warning: objtool: .orc_unwind_ip+0x18: missing section symbol for reference to weak function text lib/crc32.o: warning: objtool: .orc_unwind_ip+0x1c: missing section symbol for reference to weak function text lib/crc32.o: warning: objtool: .orc_unwind_ip+0x20: missing section symbol for reference to weak function text lib/crc32.o: warning: objtool: .orc_unwind_ip+0x24: missing section symbol for reference to weak function text lib/crc32.o: warning: objtool: .orc_unwind_ip+0x28: missing section symbol for reference to weak function text -- Josh